当我在临时表中创建值并将其插入时,我在SQL Server 2005数据库中收到此错误。
第15级状态1行5的消息102
附近的语法不正确
','
但是当我在SQL Server 2008和更高版本中运行确切的代码时,我可以成功创建行。
旧版本是否有限制?还是只是一些设置问题?
这些是我的代码示例
UnhandledPromiseRejectionWarning: Error: Opening COM6: File not found
(node:12884)
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12884) [DEP0018] DeprecationWarning:
Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
但是当我仅添加一个值时,它会起作用
create table #CustCodesMapping
(
NewCustCode varchar(30),
OldCustCode varchar(30) collate database_default
)
insert into #CustCodesMapping
values ('11111', 'aaaaa'), ('22222', 'bbbbb'), ('33333', 'ccccc')
答案 0 :(得分:2)
要重申我的评论:
为什么您仍在使用SQL Server 2005,至今已经有5多年了,它完全不受支持;升级时间很长。
对于该问题,再次是因为您使用的是SQL Server的这种过时版本。 SQL Server 2008中引入了VALUES
允许多行(这也是完全不受支持的)。您必须在2005年使用 really 旧方法:
CREATE TABLE #CustCodesMapping (NewCustCode varchar(30),
OldCustCode varchar(30) COLLATE DATABASE_DEFAULT);
INSERT INTO #CustCodesMapping (NewCustCode,OldCustCode)
SELECT '11111',
'aaaaa'
UNION ALL
SELECT '22222',
'bbbbb'
UNION ALL
SELECT '33333',
'ccccc';
但是 real 解决方案已升级到受支持的版本。不幸的是,当您使用2005时,这意味着需要进行两次升级。 2005-> 2012->支持的版本。