Update old data to use N-prefix

  • Hi

    I have ntext column in my table.

    I was storing data in it without using N-prefix in insert query.

    Now I am planning to use N-prefix in insert query of this column like:

    insert into tab values(N'Test')

    Now how can I update all old values in this column,

    which were inserted without using N-prefix,

    so that old data will be consistent with new data.

  • No need. The data in an ntext column is unicode (which is what the N prefix means). When you inserted the varchar data, SQL would have done an implicit conversion, converted the data to unicode and then put it into the column.

    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
  • I am not changing the datatype of column.

    It was previously ntext and now also it is going to be ntext.

    What I am changing is the insert query for this column.

    Previously I was storing japanese characters without using N-prefix like this:

    insert into tab values('?????')

    Now I am planning to store japanese characters using N-prefix like this:

    insert into tab values(N'?????')

    Now if I compare both the records, one which was inserted without N-prefix and another which is inserted using N-prefix, looks different in database.

    My question is that, how can I make old records to look in same format like new records?

    Will I need to fire any update query for this?

  • Hi

    Is there any way to do this?

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

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