34,575
社区成员
发帖
与我相关
我的任务
分享
INSERT INTO [table]
([FatherID],[SortID],[Title])
VALUES
(1
,这个地方我想是 table 表的总计录数再加1个,SortID是Int型的
,'标题')
INSERT INTO [table]
([FatherID],[SortID],[Title])
VALUES
(1
,(select count(*) from [table])+1
,'标题')
--服务器: 消息 1046,级别 15,状态 1,行 1
--在此上下文中不允许使用子查询。只允许使用标量表达式。
--可以使用局部变量
declare @i int
select @i=count(1)+1 from [table]
INSERT INTO [table]([FatherID],[SortID],[Title]) VALUES (1,@i,'标题')