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 |
dan_coder
Starting Member
20 Posts |
Posted - 2006-07-27 : 03:46:58
|
Hi guys.I have two databases (A & B). Every night a DTS containg 3 package truncates all tables of B and imports data from A. If there are problems on A data, they are imported in B. Is there any way to do some checks in A and terminate DTS if there are problems? I'm new with DTS!Thank you in advance!! |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-27 : 04:13:47
|
You can include conditional logic in dts.Easiest though is to include a step in the job to call an SP to check the data then error if it finds a problem.You can include that in the dts package but it's not a good idea to make packages too complicated as then it becomes difficult to operate.Depends on what you want to check for.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
dan_coder
Starting Member
20 Posts |
Posted - 2006-07-27 : 04:44:39
|
I have to check the number of rows of a table. If it's grater then X i want to proceed with DTS, then terminate it. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-27 : 05:09:47
|
Do you want to do this on a table by table basis or abort if any tables look wrong?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-27 : 05:14:49
|
If it's table by table then you can include an sql task for each tableif (select count(*) from mytable) < 100000raiserror('low count',16,-1)Then from the success of that task go to the transfer task and from the failure go to whatever you wish (next table maybe?).If it's all or nothing I would put an initial step in the job to check all the tables - if any fail then error the job (raiserror as above). That is best using a SP on the source system controlled by the people who run that system but that might not be easiest for you.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
dan_coder
Starting Member
20 Posts |
Posted - 2006-07-27 : 05:20:36
|
Ok. Thank you very much! |
|
|
|
|
|