Chad Neely
SSC Rookie
Points: 33
More actions
May 3, 2006 at 12:08 pm
#90901
I need to update the same filed in about 40 databases to Yes (1) at the some time based on a query. Any thoughts?????
mngong
SSCertifiable
Points: 6167
May 3, 2006 at 12:58 pm
#635755
Create linked servers to all servers that count and depending on the results of your query , update the fields on the server in question using the linked servers
Mike
May 3, 2006 at 1:13 pm
#635762
They are on the same server, just diffrent databases. I can not use a union because I am updating
Aaron Ingold
SSCrazy Eights
Points: 9070
May 3, 2006 at 1:27 pm
#635766
Look into sp_msforeachdb. It would work something like this:
sp_msforeachdb 'if ''?'' not in (''master'', ''model'', ''msdb'', ''tempdb'')
update ?.dbo.table1 set column = ''yes'' '
May 4, 2006 at 6:08 am
#635888
I did not know about that procedure. That is awesome. Thanks
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply