Showing posts with label ms-sql. Show all posts
Showing posts with label ms-sql. Show all posts

Friday, March 23, 2012

How to get the full-text catalog name of mssql 2005 database through query?

Hello All,

Could any one please let me know how can I get the name of full-text catalog of a MS-SQL database through query?

My Intention to write an SQL-query is to do the following:

1. check if a databse has full-text catalog enabled.

2. If so then get the name of the full-text catalog.

3. Add "MOVE sysft_<full-text catalog name> TO <desired loc>.

Thanks and Regards,

Anbu

Here's a script that will get you the databases, and you can join that to the fulltext catalog views from there to do the rest of your work:

select * from sys.databases
where is_fulltext_enabled = 1
order by name

Paste this link in the URL bar of Books Online to find the catalogs for fulltext:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/ab95e6f8-51dc-4018-9d19-cc0a6de893a5.htm

Buck Woody

|||

If a database has fulltext catalog enabled, then

select name,path from database-name.sys.fulltext_catalogs

should return the name of the fulltext catalog and the physical location of the catalog.

If the database is not enabled with any fulltext catalog then the above query will not return any rows.

Monday, March 12, 2012

How to get results from a storedprocedure

To all,
I looked at the MS-SQL pubs sample database and execute the examplestored procedure reptq2 and I got 17 results set back. Where can I findan example using Visual Studio DataGrid or any means to get all theseresults from this SP.
Thanks,

Frank
Try this link for a two part tutorial in C# that can return 100 rows. Hope this helps.
http://www.dotnetjunkies.com/Tutorial/EA868776-D71E-448A-BC23-B64B871F967F.dcik|||I just remembered that Stored proc in Pubs used COMPUTE which is a none relational aggregate function in SQL Server so you have to make the code in the link work with the stored proc and Pubs. Hope this helps.|||Here's the same data from that stored procedure, in a single result set... Avoid COMPUTE BY.

use pubs
go

select
t.type,
t.pub_id,
t.title_id,
ta.au_ord,
Name = substring (a.au_lname, 1,15),
t.ytd_sales,
avg_pub.salessum as avg_pub,
avg_pub_type.salessum as avg_pub_type
from titles t
join titleauthor ta on t.title_id = ta.title_id
join authors a on a.au_id = ta.au_id
join
(
select
t.pub_id,
avg(t.ytd_sales)
from titles t
join titleauthor ta on t.title_id = ta.title_id
where
t.pub_id is NOT NULL
group by
t.pub_id
) avg_pub (pub_id, salessum) on avg_pub.pub_id = t.pub_id
join
(
select
t.pub_id,
t.type,
avg(t.ytd_sales)
from titles t
join titleauthor ta on t.title_id = ta.title_id
where
t.pub_id is NOT NULL
group by
t.pub_id,
t.type
) avg_pub_type (pub_id, type, salessum) on avg_pub_type.pub_id = t.pub_id and avg_pub_type.type = t.type
where
t.pub_id is NOT NULL
order by
t.type,
t.pub_id

Wednesday, March 7, 2012

how to get online/offline status

Hi,

i try get information about the online or offline status of a database
within ms-sql srv 2000.

I can look it up within server manager, but I'm looking for a way to get
this information from the command line or a select statement.

Is there a command or a sql statement that tells me the status of a
database ? There's some information in master.dbo.sysdatabases, but it
looks very cryptic.

Any help appreciated, thanks,
stefan"Stefan Behrens" <stefan.news@.gmx.net> wrote in message
news:Xns94DB71E9836ADstefannewsgmxnet@.195.20.224.1 16...
> Hi,
> i try get information about the online or offline status of a database
> within ms-sql srv 2000.
> I can look it up within server manager, but I'm looking for a way to get
> this information from the command line or a select statement.
> Is there a command or a sql statement that tells me the status of a
> database ? There's some information in master.dbo.sysdatabases, but it
> looks very cryptic.
> Any help appreciated, thanks,
> stefan

select databasepropertyex('master', 'status')

Simon