Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Full-Text Search / January 2005

Tip: Looking for answers? Try searching our database.

Concatenate String and Pass to FORMSOF?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HumanJHawkins - 25 Jan 2005 07:37 GMT
The following query works perfectly (returning all words on a list called
"Dolch" that do not contain a form of "doing"):

 SELECT 'Dolch' AS [List Name], dbo.Dolch.vchWord
 FROM dbo.Dolch LEFT OUTER JOIN
   dbo.CombinedLexicons ON CONTAINS(dbo.Dolch.vchWord,
     'FORMSOF(INFLECTIONAL, "doing")')
 WHERE (dbo.CombinedLexicons.vchWord IS NULL)

However, what I really want to do requires me to piece two strings together,
resulting in a word like "doing". Any time I try to concatinate strings to
get this parameter, I get an error.

For example:

 SELECT 'Dolch' AS [List Name], dbo.Dolch.vchWord
 FROM dbo.Dolch LEFT OUTER JOIN
   dbo.CombinedLexicons ON CONTAINS(dbo.Dolch.vchWord,
     'FORMSOF(INFLECTIONAL, "do' + 'ing")')
 WHERE (dbo.CombinedLexicons.vchWord IS NULL)

I have also tried using & (as in "do' & 'ing") and various forms of single
and double quotes. Does anyone know a combination that will work?

FYI, in case this query looks goofy because of the unused "CombinedLexicons"
table, it is because the end result should be a working form of the
following...
Figuring out the string concatination is just a step toward this goal:

 SELECT 'Dolch' AS [List Name], dbo.Dolch.vchWord
 FROM dbo.Dolch LEFT OUTER JOIN
   dbo.CombinedLexicons ON CONTAINS(dbo.Dolch.vchWord,
     'FORMSOF(INFLECTIONAL, ' + dbo.CombinedLexicons.vchWord  + ')')
 WHERE (dbo.CombinedLexicons.vchWord IS NULL)

Thanks!
Andy B - 25 Jan 2005 12:03 GMT
Have you tried using a variable

Something like
DECLARE @String varchar(100)

SET @String = 'do' + 'ing'
SET @String = ' FORMSOF (INFLECTIONAL,"' + @String + '")'
--PRINT @String

SELECT ..................................
WHERE CONTAINS(dbo.Dolch.vchWord, @String)

Andy

> The following query works perfectly (returning all words on a list called
> "Dolch" that do not contain a form of "doing"):
[quoted text clipped - 32 lines]
>
> Thanks!
Hilary Cotter - 25 Jan 2005 17:52 GMT
Would this work for you?

declare @string varchar(2000)
declare @searchphrase varchar(200)
set @searchphrase='do ing'
set @string='SELECT [Dolch] AS [List Name], dbo.Dolch.vchWord '
select @string=@string+ ' FROM dbo.Dolch LEFT OUTER JOIN'
select @string=@string+ ' dbo.CombinedLexicons ON
CONTAINS(dbo.Dolch.vchWord,''FORMSOF(INFLECTIONAL, '
select @string=@string +replace(@searchphrase,' ','')
select @string=@string +')'' WHERE (dbo.CombinedLexicons.vchWord IS NULL)'
print @string

Signature

Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

> The following query works perfectly (returning all words on a list called
> "Dolch" that do not contain a form of "doing"):
[quoted text clipped - 32 lines]
>
> Thanks!
HumanJHawkins - 27 Jan 2005 20:09 GMT
> Would this work for you?
>
[quoted text clipped - 8 lines]
> select @string=@string +')'' WHERE (dbo.CombinedLexicons.vchWord IS NULL)'
> print @string

It's taking me a while to see if this will work. Thanks for the suggestion.
It looks like a good path to take.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.