Solved

SQL QUERY

Posted on 2009-05-06
5
183 Views
Last Modified: 2012-05-06
What's the query if I want to select all records whose columnA (contains string) contain the word "sentense" in its string?  I used lik'%sentense%' but that's not wroking.
Thanks.
0
Comment
Question by:lapucca
  • 3
5 Comments
 

Author Comment

by:lapucca
ID: 24317812
I'm using ms sql 2005
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 300 total points
ID: 24317896
declare @tab table ( colA varchar(100 ) )
insert into @tab select 'this is a sentence'
insert into @tab select 'This is sql server'
insert into @tab select 'This is another sentence'

SELECT *
FROM @tab
WHERE colA Like '%Sentence%'
0
 
LVL 16

Assisted Solution

by:SQL_SERVER_DBA
SQL_SERVER_DBA earned 200 total points
ID: 24317898
select columnA from table where PATINDEX('%sentense%', columnA) > 1

0
 

Author Comment

by:lapucca
ID: 24317924
Why wouldn't my query below work?  It retrives nothing when I can see records that qualify this query?

SELECT *
  FROM sr
inner join  a
on sr.Id = a.Result_id
where a.Value like '%sentence%'    
0
 

Author Comment

by:lapucca
ID: 24318032
Oops,. sorry.  Typo is the problem.  
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now