Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Creating with SSIS Package in SQL2008.

Used Two SQL Script Tasks "Initiation Job" and "Update Table" .

I have few Update queries in "Update Table" and I have to update these queries on first day of Every Quarter.

So pls help me what to write in the "Initiation Job"???
Posted
Comments
ZurdoDev 18-Mar-13 10:45am    
Quarter is relative. Do you mean quarter of each year with Q1 being Jan 1? Or is this fiscal quarters for the company? Also, where exactly are you stuck?
[no name] 18-Mar-13 11:16am    
You want an SQL Job Agent.

1 solution

The best way is to use SQL Server Job Agent, you get flexibility of scheduling job at any time.
But if you are particular about SSIS and Execute SQL Task, then you may use this:

SQL
DECLARE @CanExecute INT

SET @CanExecute = CASE WHEN
                      CONVERT(VARCHAR(10),GETDATE(),112) =CONVERT(VARCHAR(10),DATEADD(qq,DATEDIFF(qq,0,GETDATE()),0),112)
                      THEN 1
                      ELSE 0
                  END

IF( @CanExecute = 1)
BEGIN
--Your Update SQL Goes here
END
 
Share this answer
 
Comments
Biodude Basava 20-Mar-13 1:30am    
Hi @Kuthuparakkal....Thanks for the solution.
I added this code with the update queries in SQL task and i set the connection. when i execute this its got failed.
Please tell me the correct procedure to create the ssis package for above?
Kuthuparakkal 20-Mar-13 2:12am    
Check your update statement.
Check connection used in Execute SQL Task
Check your permissions against the DB connection used.
Post error message.
Biodude Basava 20-Mar-13 3:03am    
If i execute the whole query in sql query window its working so there is no problem with update statement.
Connection i checked it.
I have an access.
After running the package sqlTask will appear in red color.
Kuthuparakkal 20-Mar-13 3:58am    
Post the error message
Biodude Basava 20-Mar-13 4:34am    
Package Execution Completed.Click to switch designer mode,or select Stop debugging from debug menu.
but SQL Task is shown in RED Color.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900