对数据类型而言运算符无效。运算符为 add,类型为 uniqueidentifier。

bnmjstu 2009-09-01 03:04:59
declare @sa uniqueidentifier
set @sa='1'

declare @s uniqueidentifier
declare tb cursor local for
select s='if exists(select 1 from ['+b.name+'] where ['+a.name+'] like ''%'+@sa+'%'')
print ''所在的表及字段: ['+b.name+'].['+a.name+']'''
from syscolumns a join sysobjects b on a.id=b.id
where b.xtype='U' and a.status>=0
and a.xusertype in(175,239,231,167)
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb



报错:

服务器: 消息 403,级别 16,状态 1,行 6
对数据类型而言运算符无效。运算符为 add,类型为 uniqueidentifier。
...全文
261 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bnmjstu 2009-09-02
  • 打赏
  • 举报
回复
怎么没人回
bnmjstu 2009-09-02
  • 打赏
  • 举报
回复
ss
bnmjjs 2009-09-02
  • 打赏
  • 举报
回复
and a.xusertype in(175,239,231,167)
在这里面再添加一个字段类型 36

36代表uniqueidentifier
175代表char
239代表nchar
231代表nvarchar
167代表varchar

这样就可以了
and a.xusertype in(175,239,231,167,36)
bnmjstu 2009-09-02
  • 打赏
  • 举报
回复
有没有人知道???
bnmjstu 2009-09-01
  • 打赏
  • 举报
回复
如果我对uniqueidentifier 类型进行全库检索,应该怎么做??
soft_wsx 2009-09-01
  • 打赏
  • 举报
回复
记得不可能这样赋值!
bnmjstu 2009-09-01
  • 打赏
  • 举报
回复
我要检索的类型是uniqueidentifier ,该成nvarchar(4000)是可以,原来就是nvarchar(4000)
bnmjstu 2009-09-01
  • 打赏
  • 举报
回复
哎,快沉了
soft_wsx 2009-09-01
  • 打赏
  • 举报
回复
declare @sa nvarchar(4000)
试下

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧