Tom Knowlton
asked on
CONVERT(varchar, <image datatype>) ???
select convert(nvarchar,test) from delete_tom_test
does not work
field test is of type image
does not work
field test is of type image
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried NESTING the casts like this:
select cast(cast(test as varbinary) as varchar(8000)) from delete_tom_test
YIELDS:
AAAAAAAAAAAAAAA=
Which is not correct
select cast(cast(test as varbinary) as varchar(8000)) from delete_tom_test
YIELDS:
AAAAAAAAAAAAAAA=
Which is not correct
>>How can I view what is stored in an image datatype as text ????<<
Simply put: You can't.
Simply put: You can't.
You can't. SQL server just doesn't know how to convert from image to varchar.
ASKER
Might .NET know how to do it.....like a C# application?
No. Only the person who insterted would know what is in that column :) It is a binary data. It could be anything. So read it and you would get byte array. Then use GetChars to convert to string.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemTextASCIIEncodingClassGetCharsTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemTextASCIIEncodingClassGetCharsTopic.asp
Obviouly that would work only if the data in the column is valid text data to begin with. What I mean by that, if someone inserted jpeg data in that columns, no code can convert it to text.
ASKER
So there is no way to view an image datatype as text no matter how many hoops I jumpt through?
Or are you saying...specifically..... varchar won't work but other conversions will work ?????
Or are you saying...specifically.....
>>no matter how many hoops I jumpt through?
No :)
Not in T-SQL.
No :)
Not in T-SQL.
ASKER
Oh.....all right then.
Boy will my friend be MAD. LOL.
Boy will my friend be MAD. LOL.
ASKER
How can I view what is stored in an image datatype as text ????