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
 General SQL Server Forums
 New to SQL Server Programming
 How to Select all rows starting with numbers

Author  Topic 

jag17
Starting Member

4 Posts

Posted - 2008-02-01 : 09:09:43
Hi

I have a table with one column

Shop Name
---------------
123 Shop
#56 Shop
@Shop
Astar Shop
Best Shop


I want to write a sql select statement and produces the following result

Shop Name
---------------
123 Shop
#56 Shop
@Shop


Please help me on this

Cheers
-Jag




visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-01 : 09:32:59
You probably will find this helpful:-
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81901
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-02-01 : 09:35:31
CREATE TABLE #temp
(ID INT,
someText VARCHAR(100)
)

INSERT INTO #temp
SELECT 1,'sssss'
UNION
SELECT 2,'1sss'
UNION
SELECT 3,'dddd'
UNION
SELECT 4,'2dddd'
UNION
SELECT 4,'#dddd'

SELECT ID,someText FROM #temp WHERE
substring(someText,1,1) NOT like '%[a-z]'



DROP TABLE #temp

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-01 : 09:43:54
[code]select * from
(
select '123 Shop' as ShopName union all
select '#56 Shop' union all
select '@Shop' union all
select 'Astar Shop' union all
select 'Best Shop' ) t
where ShopName not like '[a-z]%'[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -