locked
How to use the Output clause for the updated statment RRS feed

  • Question

  • How to use the output clause for the below update stament,

    DECLARE @MyTableVar table(
        sname int NOT NULL)

    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;

    Here am getting one error incorrect syntax near Output

    i want to return the updated value from output clause


    • Edited by Ychinnari Wednesday, March 11, 2015 11:05 AM
    Wednesday, March 11, 2015 11:03 AM

Answers

All replies