use*_*021 4 sql-server ssms temp-tables
我正在使用Microsoft SQL Server Management Studio,我正在尝试运行以下查询以将值输入到临时表中以供以后使用:
CREATE TABLE #temptable
(colnumber varchar(15), dispcode varchar(10))
INSERT INTO #temptable (colnumber, dispcode)
VALUES
('col5', '811'),
('col6', '817'),
('col7', '823'),
('col8', '825');
Run Code Online (Sandbox Code Playgroud)
运行时我收到以下错误:
消息102,级别15,状态1,行50
','附近的语法不正确.
哪个指向"('col5','811'),"
谁能帮我在这里找出问题所在?
Ozr*_*ric 13
对于SQL Server版本<2008,请使用以下命令:
INSERT INTO #temptable (colnumber, dispcode)
SELECT 'col5', '811'
UNION ALL SELECT 'col6', '817'
UNION ALL SELECT 'col7', '823'
UNION ALL SELECT 'col8', '825'
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
56715 次 |
最近记录: |