• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

必须声明标量变量 "@tempTable"

mysql 搞代码 4年前 (2022-01-09) 16次浏览 已收录 0个评论

MLGB 微软的sqlserver有一个BUG,在使用表 变量 进行修改时,他会提醒你: 必须 声明 标量 变量 @tempTable。 首先 /*create table test(id int identity(1,1),name varchar(10))insert into test select ‘222’union select ‘444’union select ‘455’*/godecl

<link href=”/js/syntaxhighlighter/SyntaxHighlighter.css” rel=”stylesheet” type=”text/css” />

MLGB

微软的sqlserver有一个BUG,在使用表变量进行修改时,他会提醒你:

必须声明标量变量 “@tempTable”。

首先

/*create table test(	id int identity(1,1),	name varchar(10))insert into test	  select '222'union select '444'union select '455'*/godeclare @mytabe table(	id int,	name varchar(10))insert into @mytabe	   select 1,'123'union  select 2,'123'union  select 4,'123'union  select 6,'123'-- 删除 delete from test	where id not in	(		select id from @mytabe	)	--(4 行受影响)--(<strong>本文来源gaodaima#com搞(代@码$网6</strong>1 行受影响)-- 增加insert into test	select name from @mytabe	--(4 行受影响)--修改update test set test.name= @mytabe.namefrom @mytabewhere [email protected]<strong>必须</strong><strong>声明</strong><strong>标量</strong><strong>变量</strong> "@mytabe"。--解决方法update test set test.name= ta.namefrom @mytabe as tawhere test.id=ta.id--(4 行受影响)	

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:必须声明标量变量 &quot;@tempTable&quot;
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址