GotKnowHow.com

How to Get SQL Records Starting with Numbers Only

by


Return SQL records starting with numbers [0-9] only.

Here's a quick SQL tip on how to get records beginning with numbers only.  Use the query string LIKE '[0-9]%'  For example:

SELECT u.UserId, u.UserName 
        FROM   dbo.aspnet_Users u WHERE AND u.UserName LIKE '[0-9]%'
        ORDER BY u.UserName

Keep in mind, If you are using a stored procedure and sending [0-9]% to the proc in a @Parameter, do NOT surround [0-9]% with single 'quotes', because the query may not work right (in SQL Server 2008.) 

 

 


0
0

Add your comment

by Anonymous - Already have an account? Login now!
Your Name:  

Comment:  
Enter the text you see in the image below
What do you see?
Can't read the image? View a new one.
Your comment will appear after being approved.

Ask a Question

140 characters left

Recent Articles

Follow Us...