Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

List of Values to Stored Procedure.

$
0
0

Hi,

I wrote a SP to pass a value to SP. It works well

ALTER PROC [dbo].[getCompleteItems] (@p_ItemID varchar(32))
AS
DECLARE @IntVariable char(32);
DECLARE @SQLString NVARCHAR(500);
DECLARE @ParmDefinition NVARCHAR(500);

/* SQL String */
SET @SQLString =
   N'select * from [dbo].[Complete_Items] where ITEM_ID = @p_ItemID';

/* Parameter Definition */
SET @ParmDefinition = N'@p_ItemID char(32)';

/* Parameter Value */
SET @IntVariable = @p_ItemID;
EXECUTE sp_executesql @SQLString, @ParmDefinition,
                    @p_ItemID = @IntVariable;


GO

The above SP works for only 1 item_id. How to pass several item_id's ???


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>