chinna_82
chinna_82

Reputation: 6403

mssql 2008 - creating stored procedure using select into

I'm new to Mssql 2008. In Oracle when im trying to create stored prod based on the value from another table i can use something similar like this;

Select username into temp_value from logintbl;

Then i insert the temp_value to my table. How do i achieve this in MSSQL? Any comments,reference or advice is highly appreciated. Thanks.

Upvotes: 0

Views: 156

Answers (1)

Paul Grimshaw
Paul Grimshaw

Reputation: 21034

Try:

DECLARE @Username nvarchar(100)
SELECT @Username = username FROM logintbl

INSERT INTO table1 (usernames)
VALUES (@username)

Upvotes: 2

Related Questions