Wondering if I save time by combining statements

  • I am using the server management studio and am trying this query which takes over an hour for each field: (I have to do this for 6 fields). Table has 20 million records

    ALTER TABLE largetable ALTER COLUMN CLAIM_NUMBER nvarchar(255)

    Is there any savings on time if I combine the field modifications into one statement or should I continue to run seperate queries for each field and wait the 1 hours for each query to complete?

    Thanks for any help

  • I may be mistaken, but I don't think you can combine multiple alter column statements into a single command.

    - 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

  • I just tried it... you can't combine them.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • 20 million rows is not really a lot these days. One thing you could do is create a new table with the columns structured the way you want, insert the 20 million rows - drop the old table, rename the new table.

    Basically, this is exactly what SSMS would do for you behind the scenes.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • OK - I'll try that, thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply