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
 Transact-SQL (2000)
 Prefix if found

Author  Topic 

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2005-03-08 : 02:16:59
[code]
good day to all...

i had this data...

select * from tblAydzz

prefixes MyString Expression
ZA ABCDE True
ZA WXYZM True
LO LOUAI True
MN LOUAI False


I want to return an expression TRUE if any character on prefixes is found on MyString else FALSE.
[/code]

Want Philippines to become 1st World COuntry? Go for World War 3...

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-03-08 : 04:17:43
have you tried adding a where clause in your sql statement?
you can use charindex or patindex for pattern matching.

quote:
Originally posted by jonasalbert20


good day to all...

i had this data...

select * from tblAydzz

prefixes MyString Expression
ZA ABCDE True
ZA WXYZM True
LO LOUAI True
MN LOUAI False


I want to return an expression TRUE if any character on prefixes is found on MyString else FALSE.


Want Philippines to become 1st World COuntry? Go for World War 3...



--------------------
keeping it simple...
Go to Top of Page

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2005-03-08 : 04:48:12
please can u show me how... tnx....

Want Philippines to become 1st World COuntry? Go for World War 3...
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-08 : 05:23:11
select * from tblAydzz
where charindex(left(prefixes, 1), MyString)>0 or charindex(right(prefixes, 1), MyString)>0

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -