Altering column remotedly on server

  • 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.

  • 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

  • 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.

  • 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