Gossamer Forum
Home : General : Databases and SQL :

Stored Procedure Issue

Quote Reply
Stored Procedure Issue
Hi, I'm trying to create a stored procedure and have a specific problem. I have a field named itemNbr. Is there a way to set a variable in my stored procedure, which holds a value of 'qty' PLUS the value of itemNbr (concatenate, NOT add as in mathWink), and then use the value of this variable as a field name in my INSERT statement (to insert a value into another table into the field named qty[itemNbr] (IOW, if the original itemNbr field contains 'G555', then the field name in this other table is qtyG555)?

I know this isn't sql syntax, but I'd like to be able to something like:

-- assume [itemNbr] is defined in the code above...

thisQtyItem = 'qty' + [itemNbr]

INSERT INTO customer_order ([eval(thisQtyItem)], [name], [order_date]......


Is there a way to accomplish this in SQL? Any advice would be greatly appreciated. Smile

Thanks!

.--. .-. --- --. .-. .- -- -- . .-.
chris brenz
http://www.brenz.net/

"Two men enter, one man leaves."

Last edited by:

octo: Jun 12, 2003, 8:31 AM