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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Range on varchar between varchar & numeric

Author  Topic 

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2013-09-13 : 02:21:23
Hi, i need help please.
Range on varchar between varchar & numeric
Itemcode Varchar(35)
select * from dbo.Dim_Item where ItemCode = 'CL00001' -- works
select * from dbo.Dim_Item where ItemCode = '999999' -- works

but the moment i want to range:
ItemCode BETWEEN 'CL00001' AND '999999' --NO RESULT

i tried:
where ItemCode >= 'CL00001' AND ItemCode <='999999' --NO RESULT
where CAST(itemcode AS varchar(10)) BETWEEN 'CL00001' AND '999999' --NO RESULT

Please Help

VeeranjaneyuluAnnapureddy
Posting Yak Master

169 Posts

Posted - 2013-09-13 : 02:39:19
WHERE CONVERT(VARCHAR,itemcode) BETWEEN 'CL00001' AND '999999'

veeranjaneyulu
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2013-09-13 : 02:48:07
Thank You but still No Result

I duplicated the post apologies, i should have done it on 2008 first
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-09-13 : 03:08:17
Follow this thread on http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=188179&

--
Chandu
Go to Top of Page
   

- Advertisement -