A stored procedure is called and the data needs to be updated if it already exists and inserted if it does not.
IF EXISTS (SELECT * FROM Table1 WHERE Column1='SomeValue')
UPDATE Table1 SET (...) WHERE Column1='SomeValue'
ELSE
INSERT INTO Table1 VALUES (...)
This solution for above Question
CREATE proc [dbo].[ConvertCharToBinary1](@Value3 varchar(8000),@Value1 varchar(8000))
as
Begin
IF EXISTS (select * from [dbo].table1 WHERE [int_c]=convert(binary,cast(@Value3 as int)))
UPDATE table1 SET [int_c]=convert(binary,cast(@Value3 as int)),
[char_c]=(cast(cast(@Value1 as char(4000))as binary(4000))) where [int_c]=convert(binary,cast(@Value3 as int))
ELSE
insert into [dbo].table1([int_c],[char_c]) values
(
convert(binary,cast(@Value3 as int)),
cast(CAST(@Value1 as char(50)) as binary(50))
)
End
GO