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 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -