|
-
Jul 23rd, 2003, 08:08 AM
#1
Thread Starter
Fanatic Member
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:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE [update_TBL_SCALE_EVENT_2]
@ProductID char(20),
@Scale_Event_ID numeric output
as
DECLARE @ErrorSave INT
SET @ErrorSave = 0
SELECT LABEL_SPECIFICATION.PRODUCT_CODE, LABEL_SPECIFICATION.PRODUCT_LINE, LABEL_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER,
LABEL_SPECIFICATION.PRODUCT_DESCRIPTION, LABEL_SPECIFICATION.TWIST_1,
LABEL_SPECIFICATION.AFTER_TREATMENT, LABEL_SPECIFICATION.ENDS, LABEL_SPECIFICATION.SURFACE_DENSITY,
LABEL_SPECIFICATION.METRIC_DESCRIPTION, LABEL_SPECIFICATION.AVERAGE_UNIT,
LABEL_SPECIFICATION.SPECIAL_DESCRIPTION, LABEL_SPECIFICATION.TIE_ON_TAILS, LABEL_SPECIFICATION.OVERSPRAY,
PACKAGING_SPECIFICATION.PACKAGE_SPECIFICATION_REVISION,
PACKAGING_SPECIFICATION.CARTONS_PER_PALLET,
PACKAGING_SPECIFICATION.INDIVIDUAL_PACKAGE_WEIGHT,PACKAGING_SPECIFICATION.PALLET_LENGTH,PACKAGING_SPECIFICATION.TARE_WEIGHT_OF_PACKAGING
FROM LABEL_SPECIFICATION INNER JOIN
PACKAGING_SPECIFICATION ON
LABEL_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER = PACKAGING_SPECIFICATION.PACKAGE_SPECIFICATION_NUMBER
where Label_Specification.Product_Code = @ProductID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
the returned RS needs to be passed to be update SP
Thanks
** HOLLY ** 
-
Jul 23rd, 2003, 08:20 AM
#2
Are you familiar with CURSORS? Because that would be the only way (within SQL) to do what you want to do.....
-
Jul 23rd, 2003, 12:59 PM
#3
Addicted Member
With SQL 2000 there is also a Table data type.
-
Jul 23rd, 2003, 02:12 PM
#4
Junior Member
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.
-
Jul 24th, 2003, 01:55 AM
#5
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|