question

MillerT avatar image
MillerT asked

Convert nvarchar to text

Hi All.. I have a SQL DB provided by a vendor and am trying to retrieve data from this DB. I have a problem when it comes to nvarchar data. I want to convert this to text but cannot find out the syntax to use e.g. Convert(varchar, column) Any help would be great.. thanks
convertnvarchar
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kev Riley avatar image
Kev Riley answered
`text` datatype is deprecated. What version of SQL is this using, and why do you need this as `text`.
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MillerT avatar image MillerT commented ·
SQL Version 2005 I am trying to read this data into a different system (not SQL) and it does not like the nvarchar datatype. If I can convert to another format e.g. STRING or VARCHAR then I would be able to use the data. All values in the column in question are all strings so the use of nvarchar by the vendor was incorrect in the first place. Thanks
0 Likes 0 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
in that case just use cast(yourcol as varchar(max))
0 Likes 0 ·
MillerT avatar image MillerT commented ·
Thanks Kev... just some persistence using CAST(CAST(COL AS VARCHAR(131)) AS TEXT) sorted the issue. Thanks for the assistance
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.