Table datatype in stored procedure

  • Hello,

    iam trying to use Table data type in storedprocedure as OUTPUT parameter.

    but iam getting error. could any one explains.

    Thanks

    ravi

  • Could you post the error you're receiving?

  • Here is my code

    -----

    create procedure Usp_TableType

    @table1 table(sno int,sname varchar(20))

    as

    insert into @table1 values(1,'xyz')

    return @table1

    go

    ----

    here is error messages

    Server: Msg 156, Level 15, State 1, Procedure Usp_TableType, Line 2

    Incorrect syntax near the keyword 'table'.

    Server: Msg 137, Level 15, State 1, Procedure Usp_TableType, Line 4

    Must declare the variable '@table1'.

    Server: Msg 137, Level 15, State 1, Procedure Usp_TableType, Line 5

    Must declare the variable '@table1'.

  • I guess you cannot use Table data type for Create Procedure statement. According to BOL, You can use this for "DECLARE @local_variable and CREATE FUNCTION".

    .

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

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