Stored procedure from asp help

Discussion in 'ASP General' started by Mike D, Jan 14, 2005.

  1. Mike D

    Mike D Guest

    I have a stored procedure that I am executing with this SQL
    osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo = 37,
    @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604, 605, 606,
    607, 608, 609, 610, 611, 612, 613, 616'

    the @Schedules are ID fields in a table that are integers. I would like to
    do an Update blah, Where ScheduleID in (@Schedules) instead of looping. How
    can I do this? I have to sent the values to the sproc as text, right? Where
    do I covert to the int data type and how?

    Thanks for your help
    Mike
    Mike D, Jan 14, 2005
    #1
    1. Advertising

  2. http://www.aspfaq.com/2448

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Mike D" <> wrote in message
    news:...
    > I have a stored procedure that I am executing with this SQL
    > osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo = 37,
    > @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604, 605, 606,
    > 607, 608, 609, 610, 611, 612, 613, 616'
    >
    > the @Schedules are ID fields in a table that are integers. I would like

    to
    > do an Update blah, Where ScheduleID in (@Schedules) instead of looping.

    How
    > can I do this? I have to sent the values to the sproc as text, right?

    Where
    > do I covert to the int data type and how?
    >
    > Thanks for your help
    > Mike
    Aaron [SQL Server MVP], Jan 14, 2005
    #2
    1. Advertising

  3. Mike D

    Mike D Guest

    Am I missing something? I read that and don't see anything that applies to
    my problem. Did you post the right link?

    Thanks again
    Mike

    "Aaron [SQL Server MVP]" wrote:

    > http://www.aspfaq.com/2448
    >
    > --
    > http://www.aspfaq.com/
    > (Reverse address to reply.)
    >
    >
    >
    >
    > "Mike D" <> wrote in message
    > news:...
    > > I have a stored procedure that I am executing with this SQL
    > > osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo = 37,
    > > @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604, 605, 606,
    > > 607, 608, 609, 610, 611, 612, 613, 616'
    > >
    > > the @Schedules are ID fields in a table that are integers. I would like

    > to
    > > do an Update blah, Where ScheduleID in (@Schedules) instead of looping.

    > How
    > > can I do this? I have to sent the values to the sproc as text, right?

    > Where
    > > do I covert to the int data type and how?
    > >
    > > Thanks for your help
    > > Mike

    >
    >
    >
    Mike D, Jan 14, 2005
    #3
  4. Mike D wrote:
    > I have a stored procedure that I am executing with this SQL
    > osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo =
    > 37, @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604,
    > 605, 606, 607, 608, 609, 610, 611, 612, 613, 616'
    >
    > the @Schedules are ID fields in a table that are integers. I would
    > like to do an Update blah, Where ScheduleID in (@Schedules) instead
    > of looping. How can I do this? I have to sent the values to the
    > sproc as text, right? Where do I covert to the int data type and how?
    >
    > Thanks for your help
    > Mike

    This is relevant:
    http://www.sommarskog.se/arrays-in-sql.html

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jan 14, 2005
    #4
  5. Sorry.
    http://www.aspfaq.com/2248

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Mike D" <> wrote in message
    news:...
    > Am I missing something? I read that and don't see anything that applies

    to
    > my problem. Did you post the right link?
    >
    > Thanks again
    > Mike
    >
    > "Aaron [SQL Server MVP]" wrote:
    >
    > > http://www.aspfaq.com/2448
    > >
    > > --
    > > http://www.aspfaq.com/
    > > (Reverse address to reply.)
    > >
    > >
    > >
    > >
    > > "Mike D" <> wrote in message
    > > news:...
    > > > I have a stored procedure that I am executing with this SQL
    > > > osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo =

    37,
    > > > @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604, 605,

    606,
    > > > 607, 608, 609, 610, 611, 612, 613, 616'
    > > >
    > > > the @Schedules are ID fields in a table that are integers. I would

    like
    > > to
    > > > do an Update blah, Where ScheduleID in (@Schedules) instead of

    looping.
    > > How
    > > > can I do this? I have to sent the values to the sproc as text, right?

    > > Where
    > > > do I covert to the int data type and how?
    > > >
    > > > Thanks for your help
    > > > Mike

    > >
    > >
    > >
    Aaron [SQL Server MVP], Jan 14, 2005
    #5
  6. Mike D

    Mike D Guest

    Thanks to both of you for your replies. It helps me solve the problem. Does
    the new SQL Server (2005?) have any better way to handle arrays than SQL
    Server 2000??

    Thanks
    Mike


    "Bob Barrows [MVP]" wrote:

    > Mike D wrote:
    > > I have a stored procedure that I am executing with this SQL
    > > osp_instrument_swap @InstrumentFrom = 'testname', @InstrumentIDTo =
    > > 37, @Schedules = '593, 594, 596, 598, 599, 600, 601, 602, 603, 604,
    > > 605, 606, 607, 608, 609, 610, 611, 612, 613, 616'
    > >
    > > the @Schedules are ID fields in a table that are integers. I would
    > > like to do an Update blah, Where ScheduleID in (@Schedules) instead
    > > of looping. How can I do this? I have to sent the values to the
    > > sproc as text, right? Where do I covert to the int data type and how?
    > >
    > > Thanks for your help
    > > Mike

    > This is relevant:
    > http://www.sommarskog.se/arrays-in-sql.html
    >
    > Bob Barrows
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >
    >
    Mike D, Jan 17, 2005
    #6
  7. > Thanks to both of you for your replies. It helps me solve the problem.
    Does
    > the new SQL Server (2005?) have any better way to handle arrays than SQL
    > Server 2000??


    If you're brave enough to try the CLR, you can code stored procedures and
    other modules using .NET languages. So I imagine there is a way to do it
    yourself, but nothing native... there are still no such things as "arrays"
    in relational data...

    There is better XML handling, so you might be able to pass data structures
    in that way, as well.

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)
    Aaron [SQL Server MVP], Jan 17, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TJS
    Replies:
    4
    Views:
    2,110
  2. Jeff Thur
    Replies:
    2
    Views:
    1,011
    Guest
    Feb 7, 2005
  3. Mike P
    Replies:
    0
    Views:
    3,275
    Mike P
    Jun 19, 2006
  4. Bill Kellaway

    ASP / Stored Procedure SQL Insert Help

    Bill Kellaway, Oct 10, 2003, in forum: ASP General
    Replies:
    7
    Views:
    203
    Bill Kellaway
    Oct 12, 2003
  5. segis bata

    HELP!---Stored Procedure in ASP

    segis bata, Apr 3, 2006, in forum: ASP General
    Replies:
    6
    Views:
    158
    Bob Barrows [MVP]
    Apr 4, 2006
Loading...

Share This Page