all groups > sql server dts > april 2007 >
You're in the

sql server dts

group:

Reset Identity Fields or Foreach Ado.Net Schema Rowset


Reset Identity Fields or Foreach Ado.Net Schema Rowset Dinsdale
4/4/2007 11:14:09 AM
sql server dts:
The end result of what I am trying to accoplish is this: I would like
to use SSIS to reset the identity fields on all tables where the table
name ends with _type. If someone has a better suggestion than what I
am currently trying, please feel free to suggest it. That said:

I am trying to use the Foreach ADO.Net Schema Rowset loop to iterate
through the tables in the database and then extract the table_name
parameter to use in an SQL query (DBCC CHECKIDENT). I would like to
limit the tables that the foreach loop iterates through using the
collection restrictions. I cannot seem to find a way to use a wild
card to limit the recordset to tables where the table_name parameter
value ends in "type". I have tried to use a wildcard (%,*,&) in the
text field with no success. I am not sure how I would use a variable
or even build an expression that would accomplish this.

So I guess my question is how to use wildcard values in the
restrictions field to limit the tables retrieved by table name?

Thanks in advance.
Re: Reset Identity Fields or Foreach Ado.Net Schema Rowset Dinsdale
4/4/2007 12:12:02 PM
That's a great suggestion. The only reason "why not" is because it
seems to me that the foreach ado.net thing was created for this
purpose. Also, I'm a stubborn SOB. I will try your suggestion right
now. It sounds a little less like pounding my head against my monitor
than what I've been doing.

Thanks Allan!

Dinsdale

[quoted text, click to view]

Re: Reset Identity Fields or Foreach Ado.Net Schema Rowset Allan Mitchell
4/4/2007 6:19:21 PM
Hello Dinsdale,

Why not use a DataFlow to query sys.tables to get the names of the tables
into a Recordset destination(or even an ExecuteSQL task into an Object variable)
and then iterate over that instead.



--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

AddThis Social Bookmark Button