Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Range on varchar between varchar & numeric
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ismailc
Constraint Violating Yak Guru

South Africa
290 Posts

Posted - 09/13/2013 :  02:21:23  Show Profile  Reply with Quote
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

Edited by - ismailc on 09/13/2013 02:22:26

VeeranjaneyuluAnnapureddy
Posting Yak Master

India
169 Posts

Posted - 09/13/2013 :  02:39:19  Show Profile  Reply with Quote
WHERE CONVERT(VARCHAR,itemcode) BETWEEN 'CL00001' AND '999999'

veeranjaneyulu
Go to Top of Page

ismailc
Constraint Violating Yak Guru

South Africa
290 Posts

Posted - 09/13/2013 :  02:48:07  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2241 Posts

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

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000