Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
barnabeck
Posting Yak Master
236 Posts |
Posted - 2014-12-10 : 16:58:35
|
I have a string stored in a column of type image that I need to do string operations with in order to decode the containing infomation.data [image] = 0x07FD0707FD0102F001000054004C005300410000000054004C00530041000000FF...I can't cast or convert to nvarchar(max), varchar(max) as I always get an error. Explicit conversion from data type image to varchar(max) is not allowed.I tried CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), DATA))which doesn't throw an error but seems to interprete the hexadecimal code to ascii characters and therefore is useless (ýýð...)Any sugestion? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-12-10 : 17:16:59
|
It's my understanding that you would need to do this in the application and not in T-SQL, so you'd have to pull back the image to the app, do your manipulation there and then send the image back to SQL.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
barnabeck
Posting Yak Master
236 Posts |
Posted - 2014-12-10 : 17:33:40
|
I can't do anything about the format. The content of that string is one condensed log entry line that our ERP is storing in that table. I need to query that data and therefore have to do it in T-SQL.I did now CAST(CONVERT(VARBINARY(MAX), DATA) as nvarchar(max)) and it turns chinese.... :( |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-12-10 : 17:42:55
|
I don't think it's possible. Write a simple .net app or similar to do this work. Maybe you can get away with doing it in a CLR function, but I'm not sure.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|