为什么可以拼字符串呢?
我个人理解 这个应该会是分解为 select id from #
和 @s = @s+select id from #
这样的话
select id from #应该返回的是表啊?
...全文
1164打赏收藏
SQL拼接查询结果的原理?
create table # (id varchar(10)) insert into # select 'a' union all select 'b' union all select 'c' union all select 'd' declare @s varchar(100) select @s='' select @s=@s+id from # print @s abcd 这里面 select @s=@s+id from # 为什么可以拼字符串呢? 我个人理解 这个应该会是分解为
The Compute Scalar operator evaluates an expression to produce a computed scalar value. This may then be returned to the user, referenced elsewhere in the query, or both. An example of both is in a filter predicate or join predicate.