关于动态建表的一个问题
Set @CreateSQL='Create Table '+ @TableName +
'( [OpeningDirection] NCHAR (1) NOT NULL,
CONSTRAINT [CK_'+@TableName+'_OpeningDirection] CHECK ([OpeningDirection]='+'多'+' OR OpeningDirection='+'空'+'))'
Exec(@CreateSQL)
@TableName是传过来的表名,check这个地方总是报错,求指教
[最优解释]
Set @CreateSQL='Create Table '+ @TableName +
'( [OpeningDirection] NCHAR (1) NOT NULL,
CONSTRAINT [CK_'+@TableName+'_OpeningDirection] CHECK ([OpeningDirection]='+'''多'''+' OR OpeningDirection='+'''空'''+'))'
Exec(@CreateSQL)