日期:2014-05-17 浏览次数:20447 次
//若clue1在数据库中的字段是数值型 string insSql = "INSETR INTO PUZZLE(CLUE1) VALUES (" + clue1 == "" ? "null" :clue1 + ")"; //若是字符型 string insSql="INSETR INTO PUZZLE(CLUE1) VALUES ("+clue1==""?"null":"'"+clue1+"')";
------解决方案--------------------
declare @clue1 varchar(1) insert into puzziw(clue1) select case when @clue1='' then null else @clue1 end
------解决方案--------------------
InSert Into Puzzle(Clue1)
Select Case When ISNULL(clue1,'') = '' then Null Else clue1 End From 表