日期:2014-05-18 浏览次数:20507 次
IF 1=2 begin SELECT * INTO #t FROM t1 DROP TABLE #t end IF 1=3 begin SELECT * INTO #t FROM t1 DROP TABLE #t end
create table #T(col.....) if .. insert into #T... else if insert into #T ...
------解决方案--------------------
String sql = "insert into stu values(" + id + "," + name + "," + sex + "," + age + "," + weight + ")";
这句话有错吗
------解决方案--------------------
declare @sql varchar(2000) IF 1=2 begin select @sql='SELECT * INTO #t FROM '+'t1'+';DROP TABLE #t' end IF 1=3 begin select @sql='SELECT * INTO #t FROM '+'t1'+';DROP TABLE #t' end exec(@sql)