
Please Help with Stored Proc
I think your problem has a fairly simple answer but I'm not real clear
on your ddl for the coupons table.
Will it have a row for each product_id that the CouponNumber is related
to? (I hope), or do you require one row that has the CouponNumber and
comma separated string? (Ugh not even in the 1st normal form!)
Quote:
> I am trying to write a stored procedure in SQL Server 7 that will be
> called from an ASP page. Here is what I want to do:
> CREATE PROCEDURE insert_coupon
> (
> )
> INSERT INTO coupons (coupon_number, product_id) VALUES
> generated from a nested query, like 'SELECT product_id FROM products
> WHERE product_type = 1' or something like that, but I get an error
> saying that I can't do a subquery in this context.
> Is there any way to get that product_id parameter from a SQL
> variable, nor how to assign it the value returned from the SELECT
> statement.
> Anyone who can help, please respond, but please don't bombard me with
> stuff like "Why don't you just do this?" I need to do it this way for
> reasons too numerous to get into. Just tell me if there is a way to
> write this procedure, and if so, how to go about it.
> Thanks in advance.
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Sent via Deja.com http://www.deja.com/
Before you buy.