sql编程哪里错了?悬赏分:0 - 提问时间2006-8-21 21:56 问题为何被关闭if @case='1'@sql='update [plus_down_download] set dayhits=dayhits+1 where id='+@plus_down_download_idif @case='2'@sql='update [plus_down_download] set dayhits=1 where id='+@plus_down_download_idif @case='3'@sql='update [plus_down_download] set dayhits=dayhits+1 where id='+@plus_down_download_idif @case='4'@sql='update [plus_down_download] set weekhits=weekhits+1 where id='+@plus_down_download_idif @case='5'@sql='update [plus_down_download] set weekhits=1 where id='+@plus_down_download_id
參考答案:SQL里变量赋值要使用SET关键字,如:
将
@sql='update [plus_down_download] set dayhits=dayhits+1 where id='+@plus_down_download_id
改为
SET @sql='update [plus_down_download] set dayhits=dayhits+1 where id='+@plus_down_download_id