April 30, 2009 at 2:14 pm
I am trying to writing a SQL script to alter column length in the table. I can do on one server but I wanted to do remotedly on other servers too.
I know I can't do the following things but how can I alter column remotedly.
for exmaple
alter table servername.databasename.dbo.tablename
alter column columnName varchar(20) null
appreciated if somebody can help me.
April 30, 2009 at 2:21 pm
Take a look at Red Gate's MultiScript tool. Might be what you're looking for.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 30, 2009 at 2:23 pm
as long as you have remote servers or linked servers setup for RPC, this should work:
exec servername.dbname.dbo.executesql 'alter table ...'
or use sp_sqlexec, or whatever variant of this you prefer.
April 30, 2009 at 2:30 pm
Mike.. Great it's working.
Thanks
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply