Watch this example on YouTube
1. here is my stored procedure
CREATE PROCEDURE spPassIntegers
@SelectedIDs Varchar(Max) = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
Declare @SQL AS NVarchar(MAX);
SET @SQL = 'SELECT * FROM Customers WHERE ID IN (' + @SelectedIDs + ')'
Exec (@SQL)
END
GO
2. here I'm passing multiple integers to parameter
Declare @IDs Varchar(Max) = '1,2, 1003'
Exec spPassIntegers @IDs
Super Sir
ReplyDeleteVoww its an Excellent answer now a days Interviewers are asking the Same Question Now I got the Answers for that Thank you very Mch
Can you please do it by using user defined table typed??
ReplyDeleteNo
Delete