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 |
lols
Posting Yak Master
174 Posts |
Posted - 2007-09-24 : 07:25:42
|
Hi,I am using a foreach file to loop through a folder and pick a file. Then populate a Sql table. Now I want to check if the file is a mdb and then check if the mdb contains a table called "Customers". If any of these conditions fails, the file should be moved to the Error folder.How do I do this? Please specify the components to use.thanks |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-09-24 : 23:41:35
|
Not sure if you are able to check if a random mdb file contains table "Customers" in ssis. |
 |
|
lols
Posting Yak Master
174 Posts |
Posted - 2007-09-24 : 23:56:42
|
i think there is..i saw this in one of the posts but never saved the link..now i do not recollect how it was done.I need two things :1. Check if the file is mdb2. Check if a table called "Customers" exists in that mdb[Edited]Ok here it is :http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2181503&SiteID=1&mode=1Can some one guide me through this 1. How to use an expression on a Precedence Constraint to check the file extension?2. How to query to determine if the table exists?3. How to set the result to a value?thanks. |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-09-25 : 00:02:42
|
Just because a file with *.mdb exists in a folder, it doesnt mean the database with the name should exist. The files could be from detached databases. You might want to look for SQL Server instances on the box, connect to it, and query sysobjects for the table, in each db.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
lols
Posting Yak Master
174 Posts |
Posted - 2007-09-25 : 00:29:22
|
hi dinakar,thanks for the answer.you say "You might want to look for SQL Server instances on the box, connect to it, and query sysobjects for the table, in each db".The files are access database's. How is this related to SQL instances?Secondly i am checking for two things :"Now I want to check if the file is a mdb and then check if the mdb contains a table called "Customers". If any of these conditions fails, the file should be moved to the Error folder." |
 |
|
|
|
|