Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 starts with number

Author  Topic 

eevans
Starting Member

48 Posts

Posted - 2009-04-02 : 13:16:42
Hello,
I would like to pull rows where a paricular column starts with a number. Is there a quicker way of doing that than this...

column_a LIKE '0%' OR
column_a LIKE '1%' OR
column_a LIKE '2%' OR
etc.

Thanks.

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-04-02 : 13:27:38
quote:
Originally posted by eevans

Hello,
I would like to pull rows where a paricular column starts with a number. Is there a quicker way of doing that than this...

column_a LIKE '0%' OR
column_a LIKE '1%' OR
column_a LIKE '2%' OR
etc.

Thanks.



try this


SELECT *
FROM SomeTable
Where column_a LIKE '[0-9]%'


r&r
Go to Top of Page

eevans
Starting Member

48 Posts

Posted - 2009-04-02 : 13:57:39
Thanks!
Go to Top of Page
   

- Advertisement -