- USE master;
- GO
- -- The creation of our Table Variable.
- DECLARE @UserAccounts TABLE
- (
- firstName VARCHAR(50)
- , lastName VARCHAR(50)
- );
- -- Inserting 3 records into our Table Variable.
- INSERT INTO @UserAccounts
- VALUES ('John', 'Doe');
- INSERT INTO @UserAccounts
- VALUES ('Jane', 'Doe');
- INSERT INTO @UserAccounts
- VALUES ('Jim', 'Doe');
- -- Selecting the records from our Table Variable.
- SELECT * FROM @UserAccounts;
The output of running this query should be:
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
firstName lastName
-------------------------------------------------- --------------------------------------------------
John Doe
Jane Doe
Jim Doe
(3 row(s) affected)
No comments:
Post a Comment