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 2000 Forums
 SQL Server Development (2000)
 search for hyphen

Author  Topic 

David Adedeji
Starting Member

14 Posts

Posted - 2006-03-07 : 13:01:03
I will like a query that search for hypen (-) in a field called id

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2006-03-07 : 13:06:21
SELECT mt.id FROM dbo.MyTable AS mt WHERE CHARINDEX('-', mt.id) > 0
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-08 : 01:14:12
or

Where mt.id like '%-%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

David Adedeji
Starting Member

14 Posts

Posted - 2006-03-08 : 10:03:07
Thanks anyway but I already tried that and it didn't work
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-08 : 10:10:31
quote:
Originally posted by David Adedeji

Thanks anyway but I already tried that and it didn't work


What did you try?
Post some sample data and expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

David Adedeji
Starting Member

14 Posts

Posted - 2006-03-31 : 10:37:02
Where mt.id like '%-%'
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-03-31 : 10:58:59
try '%[-]%'

Corey

Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..."
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-31 : 11:08:41
David,

>> Where mt.id like '%-%'
This is not the complete answer for what Madhivanan asked [Post some sample data and expected result]

If you want something to be answered, please be more descriptive
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61253


Srinika
Go to Top of Page

CLages
Posting Yak Master

116 Posts

Posted - 2006-04-01 : 22:08:09
Dont Forget Like Works only in Char, varchar,
if your field is an INT will not Work

C.lages
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-01 : 23:26:44
quote:


Dont Forget Like Works only in Char, varchar,
if your field is an INT will not Work



Do INT Datatype can store '-' ? i dont think so..



If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-04-02 : 06:23:55
could it be...

where id<0

rockmoose
Go to Top of Page
   

- Advertisement -