Solved

SQL max command

Posted on 2011-02-14
2
841 Views
Last Modified: 2012-05-11
I have the follwoing data in the table.

wID
WS-1000
IS-1001
MS-10001

Two letters, a hyphen then number 4 to 5 digits. How can I select the maximum number from the digit part?

thanks

ayha
0
Comment
Question by:ayha1999
2 Comments
 
LVL 9

Accepted Solution

by:
s_chilkury earned 250 total points
ID: 34890219
Try:
SELECT @NId = MAX(CAST(SUBSTRING(field, 4, len(field)) as INT))  FROM [table];
0
 
LVL 7

Author Closing Comment

by:ayha1999
ID: 34890295
thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now