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 |
osmansays
Starting Member
6 Posts |
Posted - 2006-06-14 : 04:21:25
|
I have an Int and varchar values saved in an Image data field and I want to retrive them and make queries upon these values , how can I write a stored procedure to do that ? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-14 : 04:46:47
|
Why did you store int and varchar data in image column?Use proper datatype to store dataPost some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-06-14 : 07:46:35
|
If you must, you can convert it to varbinary and then to varchar. But you should listen to madhivanan's sage advice.--datadeclare @t table (x image)insert @t select '1'union all select '2'union all select 'A'--calculationselect cast(cast(x as varbinary) as varchar(10)), x from @t/*results x ---------- ------1 0x312 0x32A 0x41*/ Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
|
|
osmansays
Starting Member
6 Posts |
Posted - 2006-06-14 : 10:12:53
|
thanks RyanRandall and madhivanan ,I know , it is strange to save int and varchar in Image field but I have to because I am quering a database table for a product that we bought from a company so it is not my choice to insert values like this in Image field . I tried the select query statment that RyanRandall wrote in analyzer and it returns an empty field to me ???!!! I still can not get the values and I am sure there is values some are integer values and some are varchar . |
|
|
|
|
|