1
Hi Subin,
You can use out parameter in SQL procedure
- CREATE PROCEDURE dbo.uspGetRole @Id int, @UserRole int OUTPUT
- AS
- SELECT @UserRole = columnsName
- FROM TableName
- WHERE Id = @Id
1
hey thanks piyush for the response i got the code eventually
1
Hi Subin, Please share the code. So, we can help you..
Thanks
0
you can try this code......
- DECLARE @sqlCommand nvarchar(1000)
- DECLARE @city varchar(75)
- declare @counts int
- SET @city = 'New York'
- SET @sqlCommand = 'SELECT @cnt=COUNT(*) FROM customers WHERE City = @city'
- EXECUTE sp_executesql @sqlCommand, N'@city nvarchar(75),@cnt int OUTPUT', @city = @city, @cnt=@counts OUTPUT
- select @counts as Counts