我想用 SQL 查询写一个 with in 。
去一些错误。请帮忙:
DECLARE @Start AS DATETIME;
DECLARE @End AS DATETIME;
SET @Start = '2013-04-09';
SET @End = '2013-04-11';
with View_Solidnet_Training as
(
with View_Solidnet_Training as
(
select cast(@Start as datetime) DateValue
union all
select DateValue + 1
from View_Solidnet_Training
where DateValue + 1 <= cast(@End as datetime)
)
insert into OBJ_Availability
select 34, DateValue, 'AM', 2, 'Test' from View_Solidnet_Training;
)
select * from View_Solidnet_Training where PK_Training_ID is not null;
错误:
消息 156,级别 15,状态 1,第 7 行
关键字“with”附近的语法不正确。
消息 319,级别 15,状态 1,第 7 行
关键字“with”附近的语法不正确。如果此语句是公用表表达式或 xmlnamespaces 子句,则前面的语句必须以分号结束。
消息 102,级别 15,状态 1,第 17 行
')' 附近的语法不正确。