-
Insert data from temp to Destination table
Hi,
I have created a stored Procedure.Inside this stored Proc another client proc Executes.
I have to pass @statdate and @enddate parameter values. I need to extract last 5 days of data
So I have declared two variables @sdate and @edate, values getdate()-5 and getdate().
Client Proc insert the extracted data in a temp table.
According to the req I have to first delete 5 days of data from destination table and then Insert
data from temp table to destination,In case of job failure we do not loose any data.
I cannot truncate the table because it is a huge table.
I do not have any Pk on the table and I cannot define one.
Please help
Ex of my stored Proc--
Create Procedure Test
AS
Begin Try
Declare @sdate datetime,
@edate datetime
Set @sdate = getdate()-5,
@edate = getdate()
If object_id('abc_temp) is not null
drop table abo_temp
Exec client_proc
-----
-----
-----
@startdate = @sdate,
@enddate = @edate
-----
-----
@TableUsage = '|CREATE|',
@ResultTableName = 'abc_temp'
Please help
Thanks
-
Not sure I understand what is the problem with your solution.
-
try to atach the file maybe is helpful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|