首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

执行动态语句,单引号有关问题

2012-03-09 
执行动态语句,单引号问题做个查询,条件比较多,大致意思如下:declare@strSQLvarchar(1000)--select*fromtab

执行动态语句,单引号问题
做个查询,条件比较多,
大致意思如下:
declare   @strSQL   varchar(1000)

--select   *   from   table   where   col1   =   ' '   and   col2   =   ' '

select   @strSQL   =   ?
querry语句   是注释那条.@strSQL   该怎么写。
exec   @strSQL


[解决办法]
declare @strSQL varchar(1000)
--select * from table where col1 = ' ' and col2 = ' '
select @strSQL = 'select * from table where col1 = ' ' ' ' and col2 = ' ' ' ' '
exec(@strSQL)
[解决办法]
declare @strSQL varchar(1000)
select @strSQL = 'select * from table where col1 = ' ' ' ' and col2 = ' ' ' ' '
exec(@strSQL)

热点排行