Solved

SQL QUERY

Posted on 2009-05-06
5
203 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
New and Previous Values in a Query 7 35
MYSQL responding very slow 3 48
SQL Recursion 6 33
T-SQL Query - Group By Year 3 25
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 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