SQL Server Forums
Profile | Register | 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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ismailc
Constraint Violating Yak Guru

South Africa
286 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
286 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
2215 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  
 New 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