复制代码 代码如下:
CREATE TABLE StateList(StateId int, StateName char(2)) 
GO 
-- Declare variable and assign a value in a single statement 
DECLARE @Id int = 5 
-- Insert multiple rows in a single statement with IDs 5, 6, and 7 
INSERT INTO StateList VALUES(@Id, 'WA'), (@Id + 1, 'FL'), (@Id + 2, 'NY') 
-- Use compound assignment operator to increment ID values to 6, 7, and 8 
UPDATE StateList 
SET StateId += 1 
-- View the results 
SELECT * FROM StateList
新闻热点
疑难解答