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 |
|
chalana2004
Starting Member
3 Posts |
Posted - 2006-01-10 : 07:58:08
|
| hi all ,i have 60 VIEWS (SQLSERVER) with the table dbo.tblname and i want to replace the table dbo.tblname with the table dbo.tblname in all VIEWS with xdb.tblname .how can i do it automatically with a store procedure or a script ?thanks |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-01-10 : 08:57:20
|
| Generate scripts, Use Find & replaceRun the script |
 |
|
|
chalana2004
Starting Member
3 Posts |
Posted - 2006-01-12 : 04:54:40
|
quote: Originally posted by Srinika Generate scripts, Use Find & replaceRun the script
please how can i generate a script?thanks bye |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-12 : 04:56:48
|
| use Enterprise Manager, navigate to VIEWS, select the views that you want, right click and select GENERATE SQL SCRIPT-----------------'KH'Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. |
 |
|
|
chalana2004
Starting Member
3 Posts |
Posted - 2006-01-12 : 05:00:44
|
thanks but my question ist how can i do it automatically for all 60 views? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-12 : 05:23:28
|
| Do as Srinika suggested, is it good enough ?-----------------'KH'Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-01-12 : 14:30:40
|
| "thanks but my question ist how can i do it automatically for all 60 views?"It will take about 5 minutes, probably less, using the suggestions method. Is this good enough, or do you have a recurring need which makes it necessary to "automate" this?Kristen |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-12 : 19:42:53
|
| >> do it automaticallyHow often you are going to do this ? This should be a one off task. If you have to keep changing your view's base table there might be something wrong in the design.-----------------'KH'Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. |
 |
|
|
|
|
|
|
|