sql 三个引号引发的想想

如何拼写sql语句

declare @sql varchar(8000)
set @sql = 'select name,'
select @sql = @sql + 'sum(case subject when '''+subject+'''
then source else 0 end) as '''+subject+''','
from (select distinct subject from test) as a
print @sql

posted on 2008-06-25 18:44  neil-zhao  阅读(410)  评论(0编辑  收藏  举报

导航