mattegol
asked on
Check if exists in stored procedure with table type
Hi,
I have a stored procedure that inserts from a table type like the code below:
How can I check if xxxx already exists and instead Update that row?
I use this for inserting messages through BizTalk.
Best Regards
I have a stored procedure that inserts from a table type like the code below:
How can I check if xxxx already exists and instead Update that row?
I use this for inserting messages through BizTalk.
Best Regards
ALTER PROCEDURE [dbo].[InsertStuff]
(
@parStuff AS dbo.StuffTableType READONLY
)
AS
SET NOCOUNT ON
BEGIN
DECLARE
@id int
INSERT INTO dbo.Stuff(
[xxx],[xxxx],[xxxxx]
SELECT [xxx],[xxxx],[xxxxx]
FROM @parStuff;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
INSERT INTO dbo.Stuff(
[xxx],[xxxx],[xxxxx]
SELECT [xxx],[xxxx],[xxxxx]
FROM @parStuff;