Putting result of an SQL in a variable

  • Hello,

    I am a stored procedure newbie and would like to insert the result of an SQL statement to a variable so i can use the result in the rest of the stored procedure. How can I do that?

    I am trying the following:

    declare @latestIDint

    @latestIDint= select IDENT_CURRENT('tbl_users')

    but i get:

    Line 3: Incorrect syntax near '@omar'.

    I appreciate any pointers, thank you.

  • declare @latestID int

    select @latestID = IDENT_CURRENT('tbl_users')

  • worked like a charm, thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply