Showing posts with label full-text. Show all posts
Showing posts with label full-text. Show all posts

Monday, March 12, 2012

How to dynamic specify the colums in Full-Text Search?

My problem is simple: i want to dynamic specified the columns in the
ContainsTable, this is possible? Please see the example.
<Code>
Declare @.Test1 int
Declare @.Test2 int
Declare @.Query varchar(50)
Declare @.Temp varcahr(50)
--Test
Set @.Test1=1
Set @.Test1=0
Set @.Query='something'
--Add the columns to put in containstable
IF (@.Test1=1)
Begin
Set @.Temp='ID'
End
IF (@.Test2=1)
Begin
Set @.Temp= @.Temp + ',Name'
End
SELECT *
FROM
<table>
INNER JOIN
CONTAINSTABLE (<table>, @.Temp, @.Query) AS KEY_TBL
ON <table>.ID = KEY_TBL.[KEY]
</Code>
Thanks
you can only search on one column at a time, or if you are using contains or containstable, on all columns.
To get what you want you would have to do something like this
select * from tablename where contains(col1, 'test') or contains(col2, 'test') or contains(col3, 'test')
|||Renato,
Hilary is correct, you can only specify one column per CONTAINSTABLE
predicate or use the astrick "*" to indicate that you want to specify all
FT-enabled columns in the referenced table. However, this will be supported
in SQL Server 2005 (codename Yukon) with multi-column syntax, for example:
SELECT PrimaryKey, Col1, Col2
FROM FT_Table
WHERE CONTAINS( ( Col1, Col2 ) , ' "john" AND "kane" ')
Until the Yukon public beta becomes available, you will need to the astrick
to specificy all columns or use Hilary's example below. You might also find
the following stored proc useful as well:
use pubs
go
-- DROP PROCEDURE sp_FTSearchPubsInfo
go
CREATE PROCEDURE sp_FTSearchPubsInfo ( @.vcSearchText varchar(7800))
AS
declare @.s as varchar (8000)
set @.s='select pub_id, pr_info from pub_info where
contains(pr_info,'+''''+@.vcSearchText+''''+')'
exec (@.s)
go
EXEC sp_FTSearchPubsInfo '(("book" or "books") and ("publish" or
"publisher"))'
go
Regards,
John
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:61A1A4F7-557D-46CD-ADB4-9D36052924C1@.microsoft.com...
> you can only search on one column at a time, or if you are using contains
or containstable, on all columns.
> To get what you want you would have to do something like this
> select * from tablename where contains(col1, 'test') or contains(col2,
'test') or contains(col3, 'test')
|||Thanks for the help.
I will try the Hillary example...
See you later

How to dynamic specify the colums in Full-Text Search?

My problem is simple: i want to dynamic specified the columns in the ContainsTable, this is possible? Please see the example.


Declare @.Test1 int
Declare @.Test2 int
Declare @.Query varchar(50)
Declare @.Temp varcahr(50)

--Test
Set @.Test1=1
Set @.Test1=0
Set @.Query='something'

--Add the column to put in containstable
IF (@.Test1=1)
Begin
Set @.Temp='ID'
End

IF (@.Test2=1)
Begin
Set @.Temp= @.Temp + ',Name'
End

SELECT *
FROM
<table>
INNER JOIN
CONTAINSTABLE (<table>,@.Temp, @.Query) AS KEY_TBL
ON <table>.ID = KEY_TBL.[KEY]

ThanksOnly in Sql Server 2005 (Yukon) that is possible... :/

Friday, March 9, 2012

How to drop a full-text that references an invalid path

I have restored an SQL database on a different server and the Full-Text
catalogs are referencing the location and full-text indexes of the previous
server.
When trying to drop I receive the error message 15601: "Full-Text Search is
not enabled for the current database. Use sp_fulltext_database to enable
Full-Text Search."
When trying EXEC sp_fulltext_database 'enable', I receive the error message
7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
Full-text
search was not installed properly."
I also tried creating the path on the new server, without success: same
error message. How can I get rid of this index?
Hi Monica
This may help you to copy the full text catalogues to the new server.
http://support.microsoft.com/kb/240867/EN-US/
You may want to try and droping the catalogues and re-create them.
John
"Monica Rocha" wrote:

> I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the previous
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search is
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error message
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>
|||drop the full text indexes on the tables, then try to drop the catalog. If
this does not word delete the offending entry from sysfulltextcatalogs. Then
create a new catalog.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Monica Rocha" <Monica Rocha@.discussions.microsoft.com> wrote in message
news:C7A986AA-2228-4567-8B68-4358CB75391A@.microsoft.com...
>I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the
> previous
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search
> is
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error
> message
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>

How to drop a full-text that references an invalid path

I have restored an SQL database on a different server and the Full-Text
catalogs are referencing the location and full-text indexes of the previous
server.
When trying to drop I receive the error message 15601: "Full-Text Search is
not enabled for the current database. Use sp_fulltext_database to enable
Full-Text Search."
When trying EXEC sp_fulltext_database 'enable', I receive the error message
7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
Full-text
search was not installed properly."
I also tried creating the path on the new server, without success: same
error message. How can I get rid of this index?Hi Monica
This may help you to copy the full text catalogues to the new server.
http://support.microsoft.com/kb/240867/EN-US/
You may want to try and droping the catalogues and re-create them.
John
"Monica Rocha" wrote:

> I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the previou
s
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search i
s
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error messag
e
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>|||drop the full text indexes on the tables, then try to drop the catalog. If
this does not word delete the offending entry from sysfulltextcatalogs. Then
create a new catalog.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Monica Rocha" <Monica Rocha@.discussions.microsoft.com> wrote in message
news:C7A986AA-2228-4567-8B68-4358CB75391A@.microsoft.com...
>I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the
> previous
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search
> is
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error
> message
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>

How to drop a full-text that references an invalid path

I have restored an SQL database on a different server and the Full-Text
catalogs are referencing the location and full-text indexes of the previous
server.
When trying to drop I receive the error message 15601: "Full-Text Search is
not enabled for the current database. Use sp_fulltext_database to enable
Full-Text Search."
When trying EXEC sp_fulltext_database 'enable', I receive the error message
7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
Full-text
search was not installed properly."
I also tried creating the path on the new server, without success: same
error message. How can I get rid of this index?Hi Monica
This may help you to copy the full text catalogues to the new server.
http://support.microsoft.com/kb/240867/EN-US/
You may want to try and droping the catalogues and re-create them.
John
"Monica Rocha" wrote:
> I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the previous
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search is
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error message
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>|||drop the full text indexes on the tables, then try to drop the catalog. If
this does not word delete the offending entry from sysfulltextcatalogs. Then
create a new catalog.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Monica Rocha" <Monica Rocha@.discussions.microsoft.com> wrote in message
news:C7A986AA-2228-4567-8B68-4358CB75391A@.microsoft.com...
>I have restored an SQL database on a different server and the Full-Text
> catalogs are referencing the location and full-text indexes of the
> previous
> server.
> When trying to drop I receive the error message 15601: "Full-Text Search
> is
> not enabled for the current database. Use sp_fulltext_database to enable
> Full-Text Search."
> When trying EXEC sp_fulltext_database 'enable', I receive the error
> message
> 7610: "Access is denied to 'S:\the-invalid-path', or the path is invalid.
> Full-text
> search was not installed properly."
> I also tried creating the path on the new server, without success: same
> error message. How can I get rid of this index?
>