Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert into table execute store procedure

Author  Topic 

krillehbg
Starting Member

1 Post

Posted - 2015-03-26 : 09:03:26
Hi everyone,

i have a INSERT INTO where i retunr the result from a store procedure.
But i want to only insert the data if the row not already exist.
How can i do that? (See Where xxxxxxxxxxxx).

I can't use a function as i store data in a temporary table in the store procedure.

Please help!


--Get Generated Times
INSERT INTO @GeneratedTimes(
ResourceId ,
DateFrom ,
DateTo )
EXEC dbo.P_GenerateTimes @ApplicationId , @EventId , @FromDate , @ToDate , @WeekScheduleId , @FromTimeToBook , @ToTimeToBook
WHERE xxxxxxxxxxxxxxxxxx

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-03-26 : 09:53:50
Insert the output of the stored procedure into a temp table, then merge the temp table with your target table.
Go to Top of Page
   

- Advertisement -