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.
Author |
Topic |
dhani
Posting Yak Master
132 Posts |
Posted - 2008-11-12 : 16:12:21
|
Hello All,in my SSIS packagei have to do the below step 1)If index exists on tablex then remove itstep 2)then all data from tablexstep 3)then load data from source file to tablexstep 4)then create index on the tablexhere my doubt is can't i do it all first two steps in one Execute Sql Task (if yes then what is separator between sql statements)Best Regardsasin |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-11-12 : 17:02:23
|
What were the results when you tried it to see what would happen?CODO ERGO SUM |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-12 : 23:48:38
|
its better to have seperate tasks for each step with error logging for each for ease of debugging. i think sequence of tasks for above scenario should be as follows1.execute sql task to drop index2. execute sql task to truncate table3.data flow task with flat file source & oledb destination4.execute sql to recreate index |
 |
|
dhani
Posting Yak Master
132 Posts |
Posted - 2008-11-13 : 11:14:21
|
Hello All,thank you for your answers,what i did was took one Execute SQL task,in that task i placed these three sql statements1)IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[empDate]') AND name = N'empDateIndex')DROP INDEX [empDateIndex] ON [dbo].empDate2)truncate table empDate3)CREATE NONCLUSTERED INDEX [empDateIndex] ON [dbo].[empDate] ( [UserID] ASC, [UserName] ASC, [FromDt] ASC, [ThroughDt] ASC)and also it could be done with sql procedure, create procedure with above three (or even more) statements then call exec procedure in Execute Sql Taskso the answer is we can execute more than 1 sql statement in Execute SQL task Best Regardsasin |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-13 : 13:36:12
|
GO is normally used as a batch separator. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|