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 |
|
ann06
Posting Yak Master
171 Posts |
Posted - 2008-04-12 : 06:10:50
|
| I want to loop through all tables in a database for the given qeurySELECT TABLE_NAMeFROM INFORMATION_SCHEMA.TABLEShow to intialize the counter and what should be the boolean expressionThank you and Best Regards |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-04-12 : 06:50:44
|
| have a look at CURSORS in Books OnlineJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-04-12 : 10:06:44
|
| ann06, if you're trying to code some admin tasks or simply want to see some good examples of t-sql code, one good place to look is some of the weblogs here - like TKizer's:http://weblogs.sqlteam.com/tarad/category/95.aspx"Running my code against multiple databases" has an example of iterating through a result set.Be One with the OptimizerTG |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-12 : 13:54:59
|
| And if you're looking for executing any specific commands on all tables of db you can even use the undocumented system stored procedure sp_Msforeachtable |
 |
|
|
ann06
Posting Yak Master
171 Posts |
Posted - 2008-04-13 : 02:24:30
|
| Thanks for the feedsBest Regards |
 |
|
|
|
|
|