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
Post a Comment