Professional Web Applications Themes

Pass table to StoredProc - Microsoft SQL / MS SQL Server

Hi, I need to pass a temp table to a stored proc, and get back the updated table. When I use 'Create Procedure procABC TmpTbl Table', it says error near Keyword table. I have tried defining columns before and after the word 'table' but that did not help either. Please help!! AnsG *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!...

  1. #1

    Default Pass table to StoredProc

    Hi,
    I need to pass a temp table to a stored proc, and get back the updated
    table.
    When I use 'Create Procedure procABC TmpTbl Table', it says error near
    Keyword table.
    I have tried defining columns before and after the word 'table' but that
    did not help either.

    Please help!!

    AnsG

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    AnsG Guest

  2. #2

    Default Re: Pass table to StoredProc

    You can't pass a table variable to a stored procedure.

    You can use a temporary table - create it in the calling stored procedure
    then use/mod it in your sp, the results will be accessible once control is
    returned to the calling sp.

    --
    Tony Rogerson
    SQL Server MVP
    http://www.sqlserverfaq.com?mbr=21
    (Create your own groups, Forum, FAQ's and a ton more)


    Tony Guest

  3. #3

    Default Pass table to StoredProc

    Hello

    While I do not know how to do that exactly i would suggest
    a few 'work-arounds'
    1. Create a permanent table with a structure you need plus
    datime column. Whenever you need to pass temp table -
    insert rows into permanent table with generated datetime
    value. And then pass datetime value to your proc. That's
    how proc can find rows which belong to this session.
    2. If you create temp table inside of stor proc and
    populate it - the proc you are calling will see temp tab
    so you do not need explicitely pass it as a parameter.

    Gene.

     
    back the updated 
    says error near 
    word 'table' but that 
    *** 
    gene Guest

Similar Threads

  1. StoredProc: How to pass 'table' as argument ?
    By Artur Bać in forum MySQL
    Replies: 2
    Last Post: December 16th, 10:21 PM
  2. Loop a Result Set Within a StoredProc
    By Warden in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: June 30th, 10:54 PM
  3. Timing Out StoredProc's
    By ssri-stew in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 17th, 03:45 PM
  4. Replies: 0
    Last Post: September 7th, 06:53 PM
  5. Replies: 2
    Last Post: August 12th, 07:55 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139