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
 Begins like/ends like query

Author  Topic 

rb31619
Starting Member

2 Posts

Posted - 2012-03-15 : 21:08:22
Hello

I am trying to select x where y like 'whatever%' and y is like '%whatever'.

The reason is I have some incomplete data where I only have the beginning and end of what I am searching for but not the middle piece.

Let me me know if there are questions about what I am trying to do.

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-15 : 22:37:28
what does that mean? Do you mean you're facing some issues and needs assistance?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rb31619
Starting Member

2 Posts

Posted - 2012-03-16 : 11:12:34
Yes, I need assistance..

I am trying to query a field that begins with 'something%' and ends with '%something'

Percent sign indicates that there is more data after what I am searching for (begins with) or before (ends with)

Can anyone help?

Thanks.

Edit: in case anyone is wondering if you want to do begins with ends with you use

Like 'whatever%whatever' and if you don't have the info in the middle it will return all cases that begin like/end with.

I'm trying to do this for a list of 10k things.. So I'm off to figure out the best way. Any help is appreciated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-16 : 11:15:42
sorry..i feel like you've answered yourself. what happened when you used Like 'whatever%whatever' ? Didnt that worked for you
I would suggest explaining your problem with some sample data if you're still facing it. Reading your post gives me feeling like you've it working!

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-16 : 11:33:59
you have to give us some real examples...

Sample Data, expected results..DDL is another plus



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -