Showing posts with label specified. Show all posts
Showing posts with label specified. Show all posts

Friday, March 23, 2012

How to enable service broker for specified database?

Hi All,

I am newbie in SQL Service broker. As we know, the is_broker_enabled can help us check whether the specified database is enabled for service broker. I would like to know

<>How can I enable servce broker for specified database if I see the value(is_broker_enabled) is 0?

<>How can I disable the service broker for specified database is I see the vlaue (is_broker_enabled) is 1? Do I need to dropped all service broker configration in the specified database?

Thanks in advance.

Michael

ALTER DATABASE test SET ENABLE_BROKER

ALTER DATABASE test SET DISABLE_BROKER

This temporarily shuts down the Service Broker operations in the database - you can enable and disable it as often as you want whether there are service broker objects in the database or not.

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... :/