| Author |
Topic |
|
yaman
Posting Yak Master
213 Posts |
Posted - 2010-04-23 : 14:43:29
|
| Hello Sir ,I am unable to compare alpha numeric field like less then and greater than.Pls help me out sir .Yaman |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 14:45:08
|
| it will only compare based on alphabetic sequence. what exactly do you want to do? plzz explain with data example------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
yaman
Posting Yak Master
213 Posts |
Posted - 2010-04-23 : 14:50:11
|
quote: Originally posted by visakh16 it will only compare based on alphabetic sequence. what exactly do you want to do? plzz explain with data example------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
SELECT TLI_PO_NO FROM EMPLYEE WHERE tli_po_no >='102' AND tli_po_no<=N'984') Results :- TLI_PO_NO-----------1155881155991908745678479664089970186488028941144245781478332229641-q2828-A45-a235680201227888701361349841969569609625333121213121212111222602425013350134501355013625430130230330430630864664768564582326520606-A7012370128701342572636451-t8547823-a1338020080198801998020280215802178022111106511106611106770138701407014122456895678989501136571512130846-A3084630845-A3084530847-A30847-B3084730848156305602436026214446024660247602455013211447712564-A111aaa6025260230602318019480206602516024480203802108364428364868365158365408365498368296024980204602508020580207802088020960253602566025460255602576025812648801966024112649501255012650127501285012950130501317013783736360248501375013850139501405014170139Yaman |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 14:52:47
|
| [code]SELECT TLI_PO_NO FROM EMPLYEE WHERE ISNUMERIC(tli_po_no)=1AND tli_po_no*1 >=102 AND tli_po_no*1<=984[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
yaman
Posting Yak Master
213 Posts |
Posted - 2010-04-23 : 15:49:39
|
quote: Originally posted by visakh16
SELECT TLI_PO_NO FROM EMPLYEE WHERE ISNUMERIC(tli_po_no)=1AND tli_po_no*1 >=102 AND tli_po_no*1<=984 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
I got error :- " Conversion failed when converting the nvarchar value ' 30542-A' to data type int "Yaman |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 15:51:52
|
quote: Originally posted by yaman
quote: Originally posted by visakh16
SELECT TLI_PO_NO FROM EMPLYEE WHERE ISNUMERIC(tli_po_no)=1AND tli_po_no*1 >=102 AND tli_po_no*1<=984 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
I got error :- " Conversion failed when converting the nvarchar value ' 30542-A' to data type int "Yaman
thats because of your data with nonnumeric part. what do you want to do with them?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
yaman
Posting Yak Master
213 Posts |
Posted - 2010-04-23 : 16:35:12
|
quote: Originally posted by visakh16
quote: Originally posted by yaman
quote: Originally posted by visakh16
SELECT TLI_PO_NO FROM EMPLYEE WHERE ISNUMERIC(tli_po_no)=1AND tli_po_no*1 >=102 AND tli_po_no*1<=984 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
I got error :- " Conversion failed when converting the nvarchar value ' 30542-A' to data type int "Yaman
thats because of your data with nonnumeric part. what do you want to do with them?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
I have one column TLI_PO_NO NVARCHAR(50) How can I compare tli_po_no like < , > and between It is possible to compare alpha numeric column .Yaman |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-04-23 : 18:29:11
|
quote: Originally posted by yamanI have one column TLI_PO_NO NVARCHAR(50) How can I compare tli_po_no like < , > and between It is possible to compare alpha numeric column .Yaman
You have already shown that YES, you can compare alpha numeric values using the <, >, and BETWEEN operators. Additionally, you stated that the results you are getting are not what you expect. You have provided sample data, but not expected results. So, if you want to tell us what results you expect from the sampel data you provided, I bet we can help. Until then, we can only guess at what you actually want.Maybe this link will help explain:http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|