我只是假设我可以在 SQL Server 2008 中放置一个set query
insideWITH
语句。
于是我写了几行代码:
with temp as
(
SELECT row_number() OVER (ORDER BY [ShareItems].ItemId) AS Row, ItemId FROM [ShareItems]
)
set @row = ItemId //<---error
但是我在上面得到了一个错误,但是在select
使用关键字的语句的情况下WITH
,没有错误???
with temp as
(
SELECT
row_number() OVER (ORDER BY [ShareItems].ItemId) AS Row, ItemId
FROM [ShareItems]
)
SELECT ItemId
FROM temp //<--- OK (no error)
有什么建议吗?