提示什么样的错误
@idname的类型必须是字符类型
如果是数字类型
一定有错SELECT 'select '+@idname+' from '+@tablename+' where '+@idname+' like '+@timeid+' order by '+@idname
执行此结果,看有没有错误
@idname的类型必须是字符类型
如果是数字类型
一定有错SELECT 'select '+@idname+' from '+@tablename+' where '+@idname+' like '+@timeid+' order by '+@idname
执行此结果,看有没有错误
解决方案 »
- server端连接database总有问题
- 求一条sql语句
- 求找出表中唯一记录SQL语句
- 求一个分页的存储过程**********************************************
- 【高手们救救小弟】第一次连接SQL2008怎么显示不起!
- 备份文件打不开
- sos
- 怎么把整型的1转换成字符串'001', 用什么函数!在线!
- 请教高手
- 求助个SQL中格式化时间日期的
- 如果判断一个表是否已经存在?
- asp编程需要 : SELECT FirstName + ' ' + LastName + Address, + CHAR(13) + City, + Region 希望使用回车时 出错
@idname varchar(30),
@idstring varchar(10),
@idtemp varchar(9)set @idname='badness_item_id'
set @tablename='badness_item_info'
set @idtemp=datepart(dd,getdate())
set @idstring=@idtemp+'[0-9]' exec ('select '+@idname+' from '+@tablename+' where '+@idname+' like '''+@idstring+''' order by '+@idname)
'''+@idstring+'''
'+@idstring+'
有什么区别?
和set @idstring=@idtemp+'[0-9]' 中的'[0-9]'有什么关系??