Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Double Quote symbol for Inches in FULL TEXT CONTAINS

69 views
Skip to first unread message

jabare....@gmail.com

unread,
Sep 18, 2012, 2:39:49 PM9/18/12
to
I've searched the Group and I can't find anything addressing my problem.
I'm searching one column for over 10,000 records, looking for 6" in the column. Full Text is being used because 16", 106", 36" all could be retuned if I simply use '%6"%'.
This Query yields an error:
SELECT key1, Character01
FROM ud23
WHERE CONTAINS(Character01,'6"')

ERROR:
Syntax error near '"' in the full-text search condition '6"'.

Please help

jabare....@gmail.com

unread,
Sep 18, 2012, 2:43:24 PM9/18/12
to
Also, I'm in SQL Server 2008

Gene Wirchenko

unread,
Sep 18, 2012, 5:36:13 PM9/18/12
to
On Tue, 18 Sep 2012 11:39:49 -0700 (PDT), jabare....@gmail.com
wrote:
I suggest that you look at the two statements around the error
statement. Statements may be getting run together. Failing that, try
retyping those statement, even if they appear to be correct.

I do not have full-text installed in my system (and I have never
used it which is why I decided to try answering) so I could not check
things out fully, but I found this

http://www.simple-talk.com/sql/learn-sql-server/understanding-full-text-indexing-in-sql-server/
and coded the following based on it. (Warning: It destroys any
database called ud23.) Does it work for you?

***** Start of Included Code *****
use tempdb
go

drop database ud23

create database ud23

use ud23

create table ud23
(
key1 varchar(10) unique not null,
Character01 varchar(max) not null
)

CREATE FULLTEXT CATALOG ud23
WITH ACCENT_SENSITIVITY = OFF

CREATE FULLTEXT INDEX ON ud23
(key1, Character01 TYPE COLUMN FileExtension LANGUAGE 1033)
KEY INDEX FullTextIndex
ON ud23
with stoplist=system

insert into ud23
(key1,Character01)
values
('one','It is 6" long.'),
('two','The 2x4s are spaced 16" center-to-center.'),
('three','Whatever you are looking for is not here.'),
('four','Six inches (6") is one-half of a foot.')

select * from ud23

SELECT key1, Character01
FROM ud23
WHERE CONTAINS(Character01,'6"')

use tempdb
***** End of Included Code *****

Sincerely,

Gene Wirchenko
0 new messages