uncleroydee
Technical User
I'm trying to write a stored procedure that will select records from one table and then update another based on the selection. The SP contains a parameter that consists of a long list of part numbers that will be used in an "IN" portion of a "WHERE" clause. The only way I can pass the list from an Active Server Page is to enclose the entire list in quotes (single or double) eg ("123,456,789,012,...".
On execution I do not receive any error message but no records are returned because SQL is looking for pns IN "123,456,789,012" instead of 123,456,789,012.
Evidently SQL Server 7.0 does not accept the quototation marks. I inserted a print command in the SP so I could view the part numbers, "pn" and "pn2" appear identical (without quotation marks).
Here's a brief example of the type of SP I'm trying to write.
CREATE PROCEDURE SP_SrgDB_MoveSomePN @pn VARCHAR (7710) OUTPUT
AS
DECLARE @pn2 varchar (7710)
SET @pn2 = REPLACE(@pn, ' " ', ' ')
BEGIN TRANSACTION
PRINT @pn
PRINT @pn2
SELECT *
FROM TBL_PN_CNTRCT
WHERE pn in (@pn2)
END TRANSACTION
If I run a simple select statement using the same PNs, sans quotes, it executes correctly and returns records, if I enclose the list of pns in quotes the query runs but returns no records.
Is it possible to remove or have SQL Server disregard the quotation marks within the parameter?
On execution I do not receive any error message but no records are returned because SQL is looking for pns IN "123,456,789,012" instead of 123,456,789,012.
Evidently SQL Server 7.0 does not accept the quototation marks. I inserted a print command in the SP so I could view the part numbers, "pn" and "pn2" appear identical (without quotation marks).
Here's a brief example of the type of SP I'm trying to write.
CREATE PROCEDURE SP_SrgDB_MoveSomePN @pn VARCHAR (7710) OUTPUT
AS
DECLARE @pn2 varchar (7710)
SET @pn2 = REPLACE(@pn, ' " ', ' ')
BEGIN TRANSACTION
PRINT @pn
PRINT @pn2
SELECT *
FROM TBL_PN_CNTRCT
WHERE pn in (@pn2)
END TRANSACTION
If I run a simple select statement using the same PNs, sans quotes, it executes correctly and returns records, if I enclose the list of pns in quotes the query runs but returns no records.
Is it possible to remove or have SQL Server disregard the quotation marks within the parameter?