Results 1 to 5 of 5

Thread: Parsing variables from a select SP to an update SP

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Parsing variables from a select SP to an update SP

    Hi

    I need to pass pass variables from my select SP to an update SP...
    Has anyone got any ideas?

    my select SP is as follows

    VB Code:
    1. SET QUOTED_IDENTIFIER OFF
    2. GO
    3. SET ANSI_NULLS ON
    4. GO
    5.  
    6.  
    7.  
    8. ALTER  PROCEDURE [update_TBL_SCALE_EVENT_2]
    9. @ProductID char(20),
    10. @Scale_Event_ID numeric output
    11.  
    12. as
    13.  
    14. DECLARE @ErrorSave INT
    15. SET @ErrorSave = 0
    16.  
    17. SELECT     LABEL_SPECIFICATION.PRODUCT_CODE, LABEL_SPECIFICATION.PRODUCT_LINE, LABEL_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER,
    18.                       LABEL_SPECIFICATION.PRODUCT_DESCRIPTION, LABEL_SPECIFICATION.TWIST_1,
    19.                       LABEL_SPECIFICATION.AFTER_TREATMENT, LABEL_SPECIFICATION.ENDS, LABEL_SPECIFICATION.SURFACE_DENSITY,
    20.                       LABEL_SPECIFICATION.METRIC_DESCRIPTION, LABEL_SPECIFICATION.AVERAGE_UNIT,
    21.                       LABEL_SPECIFICATION.SPECIAL_DESCRIPTION, LABEL_SPECIFICATION.TIE_ON_TAILS, LABEL_SPECIFICATION.OVERSPRAY,
    22.                       PACKAGING_SPECIFICATION.PACKAGE_SPECIFICATION_REVISION,  
    23.                     PACKAGING_SPECIFICATION.CARTONS_PER_PALLET,
    24.                       PACKAGING_SPECIFICATION.INDIVIDUAL_PACKAGE_WEIGHT,PACKAGING_SPECIFICATION.PALLET_LENGTH,PACKAGING_SPECIFICATION.TARE_WEIGHT_OF_PACKAGING
    25. FROM         LABEL_SPECIFICATION INNER JOIN
    26.                       PACKAGING_SPECIFICATION ON
    27.                       LABEL_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER = PACKAGING_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER
    28. where Label_Specification.Product_Code = @ProductID
    29.  
    30.  
    31. GO
    32. SET QUOTED_IDENTIFIER OFF
    33. GO
    34. SET ANSI_NULLS ON
    35. GO
    the returned RS needs to be passed to be update SP

    Thanks
    ** HOLLY **

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Are you familiar with CURSORS? Because that would be the only way (within SQL) to do what you want to do.....
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Addicted Member
    Join Date
    Mar 2003
    Location
    Minneapolis, MN
    Posts
    151
    With SQL 2000 there is also a Table data type.

  4. #4
    Junior Member
    Join Date
    Aug 2002
    Posts
    19
    You can not pass a recordset into a stored procedure. In this case it looks like you only are dealing with one record? So you could create variables for each column your select statement and pass those as individual params into one SP. Why you would want to do something like this I don't really understand.

  5. #5

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Hi


    Why I would want to do something like this?



    The reason why I need to do this is because, within my VB app
    a user enters a product code, the select is used to validate the
    code and the appropriate packing spec....the problem is that a
    user can enter the wrong code but it may exists within the tables,
    if this occurs it will still create an event.......

    Technome - I am not familiar with cursor types? I am relatively new
    to SQL.... Is there any slight chance you could send an example?

    rlwhealdon - are you suggesting that I place the Results into a temp table?

    Thanks everyone for your help!!!
    ** HOLLY **

Posting Permissions

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



Click Here to Expand Forum to Full Width