Datatype to be changed from Varchar to Nvarchar

  • Hi,

    I have few set of columns for whose datatype has to be changed from Varchar to Nvarchar , all these columns are used in many Stored Procedures and also in other DB objects.

    Please let me know how should i proceed and what are the things i have to keep in mind before making the changes so that it will not break something else.

  • Unless using Integration Services (which is a metadata control freak), normally things won't break that easily.

    SQL Server will just use implicit conversions everywhere, which may impact execution plans and the use of indexes.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • One more thing: maybe run sp_refreshview to update view metadata for views using those columns.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (10/7/2014)


    SQL Server will just use implicit conversions everywhere, which may impact execution plans and the use of indexes.

    However, since the column will be going to varchar, the implicit conversions will generally be on the other side (varchar implicitly converts to nvarchar), so shouldn't be too much of a problem.

    Just make sure that any related columns in other tables are converted as well. You'll have to drop any constraints on the columns to make the change iirc (foreign key), recreate them afterwards.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hmm, I read it as going to varchar to nvarchar.

    That is tricky, if any code uses local variables of type "varchar" to hold those columns. Given the implicit conversion of nvarchar to varchar and back, you might see conversion issues of the underlying data.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

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