Home Forums SQL Server 2008 T-SQL (SS2K8) How to update multiple column definition in single update statement RE: How to update multiple column definition in single update statement

  • I don't believe there is a way to do that. You can add multiple columns in a single command, but not alter multiple columns all at once.

    Copy-and-paste can remove most of the work with that. Might be even simpler if you're modifying a predictable set of columns, and you query sys.columns to build the basic strings.

    select 'alter table [' + object_name(object_id) + '] alter column [' + name + ']'

    from sys.columns

    where object_id = ...;

    Something like that.

    - 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