• Kristen-173977 (10/13/2015)


    If you have several columns in the same table (as ALTER COLUMN doesn't support multiple columns in a single statement) and given that some NVARCHAR columns might be PKey etc?? (which cannot be changed with ALTER TABLE ... COLUMN in this way) then it might be more efficient to do all the column changes in one pass, which will involve creating a new temporary table (in the new, revised, structure) and inserting the data into it, and then dropping the old and renaming. This will also require drop/recreate all indexes/FKeys etc. so will take care of sorting out anything in that regard)

    if you use SSMS and TABLE DESIGN, change the Nvarchar to Varchar, you can then press the "Generate script" button, copy&paste the script and cancel the Table Design, and then use/modify the script for testing / release to production / etc.

    Fortunately the two worse columns are not indexed though some others are. No PKs are char types. Seems like the temp table route is the way to go rather than alter/copy/rename each column which was really slow. Thx for the tip on table design spitting out the new script.