SQL 请高手帮忙看一下以下语法哪里有错误.USE tempdb;IF OBJECT_ID('dbo.Arrays') IS NOT NULL DROP TABLE dbo.Arrays;CREATE TABLE dbo.Arrays(arrid VARCHAR(10) NOT NULL PRIMARY KEY,array VARCHAR(8000) NOT NULL)GOINSERT INTO Arrays(arrid,arr
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 18:08:22
SQL 请高手帮忙看一下以下语法哪里有错误.USE tempdb;IF OBJECT_ID('dbo.Arrays') IS NOT NULL DROP TABLE dbo.Arrays;CREATE TABLE dbo.Arrays(arrid VARCHAR(10) NOT NULL PRIMARY KEY,array VARCHAR(8000) NOT NULL)GOINSERT INTO Arrays(arrid,arr
SQL 请高手帮忙看一下以下语法哪里有错误.
USE tempdb;
IF OBJECT_ID('dbo.Arrays') IS NOT NULL DROP TABLE dbo.Arrays;
CREATE TABLE dbo.Arrays
(
arrid VARCHAR(10) NOT NULL PRIMARY KEY,
array VARCHAR(8000) NOT NULL
)
GO
INSERT INTO Arrays(arrid,array) VALUES
('A','20,223,2544,25567,14'),
('B','30,-23433,28'),
('C','12,10,8099,12,1200,13,12,14,10,9'),
('D','-4,-6,-45678,-2');
SELECT arrid,array,n
FROM dbo.Arrays
JOIN dbo.Nums
ON n
SQL 请高手帮忙看一下以下语法哪里有错误.USE tempdb;IF OBJECT_ID('dbo.Arrays') IS NOT NULL DROP TABLE dbo.Arrays;CREATE TABLE dbo.Arrays(arrid VARCHAR(10) NOT NULL PRIMARY KEY,array VARCHAR(8000) NOT NULL)GOINSERT INTO Arrays(arrid,arr
朋友,您这个插入语句写的很新奇,这么写插入是不允许的.
通过INSERT INTO TABLE ...VALUES ...这样的方式,每次只能插入一行数据.
而您这个INSERT INTO Arrays(arrid,array) VALUES
('A','20,223,2544,25567,14'),
('B','30,-23433,28'),
('C','12,10,8099,12,1200,13,12,14,10,9'),
('D','-4,-6,-45678,-2');
没有这样的写法,如果要都插入进去,那么您麻烦点,一行一行的写.
INSERT INTO Arrays(arrid,array) VALUES ('A','20,223,2544,25567,14')
INSERT INTO Arrays(arrid,array) VALUES ('B','30,-23433,28')
.
记住,没有那种形式的INSERT INTO 语句,我不知道您是在哪里看到的,但是绝对是错误的.
多行插入可以INSERT INTO TABLE SELECT COLUMN1,COLUMN2,'1' ...FROM TABLE1 WHERE ...这样的形式.