sql server - How to write stored procedure with if then -


am new stored procedures, being familiar c#.

i need stored procedure this:

select * dbo.file_map file_sub_type = @file_sub_type , column_name =   @column_name , col_num = @col_num 

if found, return true.

if not found, insert table row error table.

can in 1 stored procedure? or need create 3 of them, 1 see if record exists, 1 insert row in error table, , top level called c# code?

a stored procedure can't "return true"...

if exists (select 1 dbo.file_map ...rest of query...) begin   return 1; end else begin   insert dbo.errortable ...columns... ...values...;   return 0; end 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -