Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can maximum value count from varchar field
Message
 
To
10/10/2006 10:20:26
Arjun Bagojikop
Dynamic Super Software
Sangli, India
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01160823
Message ID:
01160934
Views:
7
>hi
>Borislav
>
>i have created table table1 with bill_no varchar(10)
>insert records as under
>1111AAAA
>23000AAA
>AAAA1111
>22222
>
>I Want to get max 23000 only
>
>i have get max value in vpf like
>select max(val(bill_no)) as bill_no FROM TABLE1
>But i have comes problem in sql2000
This would be problem not only on SQL2000, all versions will raise that error. SQL Server can't convert varchar (or any other char types) if they contain non digit symbols. You could use CHRTRAN() UDF to remove all non digit chars and then convert it to integer. UDF functions created by Igor Nikiforov you could find here - Download #29527
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform