Home > database >  SQL in a variable can be used as a multiple values?
SQL in a variable can be used as a multiple values?

Time:11-05

Ask: if I want to use the variable to abbreviation the following statement
 INSERT INTO [TEST] 
VALUES (' 2020/5/1 ', 'zhang', 16.5),
(' 2020/5/1 ', 'zhang', 14.7),
.
(' 2020/5/1 ', 'zhang', 20.3);

If a variable cannot be used as multiple values?
Such as the following statement must be wrong, of course) :
 declare @ X nvarchar (20) 
The set @ X='2020/5/1', 'zhang'
INSERT INTO [TEST]
VALUES (@ X, 16.5),
(@ X, 14.7),
.
(@ X, 20.3);

Of new, laughed, the hope can help to give the correct wording, thank you!
  • Related