用sql 语句删除表字段报错 ould not drop constraint. See previous errors.
是这样的。 数据库有个ETL_Entity 表,在前台界面读取表结构,用户选择选择列,然后创建对应的 ETL_Entity_tmp 表,在做表字段删除的时候去不能删除 出现一些错误
这是动态数据创建sql:
	   create table '+@TableName+' 
		(
			[AutoID]  [int] IDENTITY(1,1) NOT NULL,
			[BatchNo] [bigint] NULL,
			'+@fields+'
			[Iscorrect] [char](10) NULL,
			[Reason] [nvarchar](300) NULL
		)ON [PRIMARY]
这是删除字段sql:
alter table  [dbo].[ETL_Entity_tmp] drop  Iscorrect
消息 3728,级别 16,状态 1,第 1 行
'Iscorrect' is not a constraint.
消息 3727,级别 16,状态 0,第 1 行
Could not drop constraint. See previous errors.
根据Error 提示,[ETL_Entity_tmp]表并没有创建约束。。
要删除表字段该怎么弄?请各位大侠帮忙看下。
              
------解决方案--------------------改为这样就行:
alter table  [dbo].[ETL_Entity_tmp] drop 
column  Iscorrect