Querying views: varchar data type being converted to INT - how to prevent?

Last Post 21 Feb 2008 09:02 AM by Maxer. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Maxer
New Member
New Member

--
21 Feb 2008 09:02 AM
I have a list of customerIDs.

I'm querying a view over a linked server and I'm finding that when I say CustomerID = '00000012' it gets converted to an INT.

The result still comes back, oddly if I query it as = 12 it still works.

However, I can only assume it is being converted to an int, then once the query hits the underlying table it is being converted back to varchar OR the table is having all of its values converted to INTs to compare against the int of 12 that was sent to it.

I need some way to prevent the conversion from 00000012 to 12.

If I do something like

WHERE CustID IN (Select Distinct custID from blah) then all the returned customerIDs are getting converted from varchars to ints and then I assume back again.

How do I deal with this sort of a situation?

How do I prevent the conversion to INT?

Thanks.
You are not authorized to post a reply.

Acceptable Use Policy