c# - Cannot convert varchar value to int in stored procedure in SQL Server -
i have stored procedure
create procedure [dbo].[createnewticket] (@practice_id varchar(40), ) /* insert rows ticket table */ begin declare @prctid int select @prctid = 'select id practice_detail practice_name_description = ' + @practice_id + ';' end go
but whenever passing value c# stored procedure throwing error.
conversion failed when converting varchar value 'select id practice_detail practice_name_description = bankson pt- daniel (dba);' data type int.
can explain doing wrong?
try this
create procedure [dbo].[createnewticket] ( @practice_id varchar(40), ) /* insert rows ticket table */ begin declare @prctid int select @prctid = id practice_detail practice_name_description = @practice_id; end go