Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2001
    Posts
    36

    Question Unanswered: Parameters to SP ?

    How can I pass a table variable as a parameter to a stored procedure ?

    eg.
    create proc procname ( @param table (col1 int ) )
    as
    select .....

    I get the following error :
    Server: Msg 156, Level 15, State 1, Procedure procname, Line 1
    Incorrect syntax near the keyword 'table'.


    Is there any alternate way to do this ?

    Thanks.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149

    Re: Parameters to SP ?

    You cannot pass a table variable as an input to the SP. Not sure about your logic but if it is unavoidable, one way is to populate a temp table and read from the SP and then delete it as soon as you exit from the called SP. This is one option. Sure there could be some better ones.

    - CB

    Originally posted by Decastod
    How can I pass a table variable as a parameter to a stored procedure ?

    eg.
    create proc procname ( @param table (col1 int ) )
    as
    select .....

    I get the following error :
    Server: Msg 156, Level 15, State 1, Procedure procname, Line 1
    Incorrect syntax near the keyword 'table'.


    Is there any alternate way to do this ?

    Thanks.

  3. #3
    Join Date
    Nov 2001
    Posts
    36
    Thanks for your help.
    Tired it in another way as you mentioned and it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •