Hi,
in my one of report i using store procedure where i used spit function to and working fine procedure now i calling this procedure in code and i want pass variable but from i pass like ('1,2,3')
but its not working in .........how do i pass comma separated string from code to store procedure please help me
Jisny AvPosted Aug 17, 2016, 1:29 AM
/*split*/
WHILE @NEXTPOS > 0
BEGIN
SELECT @NEXTPOS = CHARINDEX(',', @isinno, @POS + 1)
SELECT @VALUELEN = CASE WHEN @NEXTPOS > 0
THEN @NEXTPOS
ELSE LEN(@isinno) + 1
END - @POS - 1
INSERT #TBL (empid)
VALUES (CONVERT(VARCHAR(50), SUBSTRING(@EmployeeIds, @POS + 1, @VALUELEN)))
SELECT @POS = @NEXTPOS
Vinay SinghPosted Aug 15, 2016, 5:57 AM
- CREATE PROCEDURE GetEmployees
- @EmployeeIds VARCHAR(100)
- AS
- BEGIN
- SELECT FirstName, LastName
- FROM Employees
- WHERE EmployeeId IN(@EmployeeIds)
- )
- END
Rest you as given aboveManas MohapatraPosted Aug 15, 2016, 1:53 AM