SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Full Text Search Indexing For apostrophe


Full Text Search Indexing For apostrophe

Author
Message
deepzzzz
deepzzzz
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 261
Hi,

I have to use exact match in my application. If I am searching "Application's" it should display only those columns which contain value same as "Application's". But results include "application" also. I don't want to be like this. I have used the below query.

SELECT * FROM table_name WHERE CONTAINS(column_name, '"application''s"')

My SQL server version is SQL Server 2008 R2.

Please let me know if any details are required

Please help me.....:-)


Thanks
subbu1
subbu1
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1303 Visits: 695
PLS TRY BELOW CODE.
DECLARE @T1 TABLE(ID INT,NAME VARCHAR(30))
INSERT INTO @T1(ID,NAME)
SELECT 1,'AA'
UNION
SELECT 2,'BB'
UNION
SELECT 3,'"Application''s"'
UNION
SELECT 4,'"Application"'
SELECT * FROM @T1
WHERE NAME LIKE '"Application%'
deepzzzz
deepzzzz
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 261
Its showing both Application with IDs 3 & 4. I want exact match for apostrophe.

Thanks
rhythmk
rhythmk
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 1099
deepzzzz (7/16/2012)
Its showing both Application with IDs 3 & 4. I want exact match for apostrophe.


Little correction in Subbareddy code will work.

DECLARE @T1 TABLE(ID INT,NAME VARCHAR(30))
INSERT INTO @T1(ID,NAME)
SELECT 1,'AA'
UNION
SELECT 2,'BB'
UNION
SELECT 3,'"Application''s"'
UNION
SELECT 4,'"Application"'
SELECT * FROM @T1
WHERE NAME LIKE '"Application''s%'




--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
:-)
subbu1
subbu1
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1303 Visits: 695
can you tell me.
above query which output need.
subbu1
subbu1
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1303 Visits: 695
subbareddy542 (7/16/2012)
can you tell me.
above query thich output need.

rhythmk
rhythmk
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 1099
deepzzzz (7/16/2012)
Its showing both Application with IDs 3 & 4. I want exact match for apostrophe.


Hi deepzzzz,

It is always better to provide sample INSERT statements and required output to avoid any confusion.

Well let us know if you get the solution and if not then provide the required details.

--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
:-)
deepzzzz
deepzzzz
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 261
Just suppose I have table columns like this
1 Application
2 Application's
3 Foreign Application
4 Application's effect
So, if I am running query SELECT * FROM table_name WHERE CONTAINS(*, ' "Application''s" ')
I am putting " " for exact match. Double ' ' (Single quote) after application is used for representing ' inside " ".
So result of the above query should be,

2 Application's
4 Application's effect

Please let me know if you need any other explanations

Thanks
rhythmk
rhythmk
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 1099
deepzzzz (7/17/2012)
Just suppose I have table columns like this
1 Application
2 Application's
3 Foreign Application
4 Application's effect
So, if I am running query SELECT * FROM table_name WHERE CONTAINS(*, ' "Application''s" ')
I am putting " " for exact match. Double ' ' (Single quote) after application is used for representing ' inside " ".
So result of the above query should be,

2 Application's
4 Application's effect

Please let me know if you need any other explanations


So the above corrected subbareddy's query should work.
Putting again with your example.

DECLARE @T1 TABLE(ID INT,NAME VARCHAR(30))
INSERT INTO @T1(ID,NAME)

SELECT 1,'Application'
UNION
SELECT 2,'Application''s'
UNION
SELECT 3,'Foreign Application'
UNION
SELECT 4,'Application''s effect'

SELECT * FROM @T1
WHERE NAME LIKE 'Application''s%'




--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
:-)
deepzzzz
deepzzzz
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 261
The given example is working fine. But using contains in full text its not giving me the right answer
I have changed the query as below.

SELECT * FROM table_name WHERE CONTAINS(*, '"application''s%"')

This query is not working... Sad

Thanks
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search