declare @sql varchar(2000)declare @condition varchar(200)Set @condition = 'where smm_num >= "'+ 'S2010010' + '"'select @conditionselect @sql = 'select top 100 * from sms_200912 ' + @conditionexec(@sql)运行后出现如下错误 :Msg 207, Level 16, State 1, Line 1
Invalid column name 'S2010010'.我在查询定义的条件变量里面用的是双引号,因为单引号我赋不进去值,请大家帮忙指点一上,谢谢!!
Invalid column name 'S2010010'.我在查询定义的条件变量里面用的是双引号,因为单引号我赋不进去值,请大家帮忙指点一上,谢谢!!
解决方案 »
- select top 10 * from "DB_COUNTRYINFO_TBL" where (deleted=0)
- sqlserver 2000 隐藏用户表
- isNull()在SQL Server存储过程中的用法?
- SQLServer2000和SQLServer2005企业版能否像2005Express版一样,在连接字符串中用AttachDbFilename方式动态挂库?
- 如何取要到期的日期和相应的租金?
- 关于Sql Server 2000 排序的问题
- 不知道这样需求如何实现
- sqlanywhere的问题!
- 急!如何能用SQL语句把SQL数据库中2006-3-2日期格式的数据转换成2006-03-02格式的数据
- 一个有关access和oracle的问题??
- 请大家分析语句还能优化吗?
- 数据库评估大小
declare @sql varchar(2000)declare @condition varchar(200)Set @condition = 'where smm_num >= '+ '''S2010010'''select @conditionselect @sql = 'select top 100 * from sms_200912 ' + @condition
exec(@sql)
declare @sql varchar(2000)
set @sql=''
declare @condition varchar(200)Set @condition = 'where smm_num >= ''S2010010'''select @sql = 'select top 100 * from sms_200912 ' + @condition--print @sql
exec(@sql)
declare @sql varchar(2000)declare @condition varchar(200)Set @condition = 'where smm_num >='+ '''S2010010''' select @conditionselect @sql = 'select top 100 * from sms_200912 ' + @conditionexec(@sql)
declare @sql varchar(2000)declare @condition varchar(200)Set @condition = 'where smm_num >= "'+ '''S2010010' + '''"'select @conditionselect @sql = 'select top 100 * from sms_200912 ' + @conditionexec(@sql)