--Full text search query
select * from <FullTexed table name> O, CONTAINSTABLE(<FullTexed table name>, <FullTexed table column of your table>, '<search word>') AS K
WHERE K.[KEY] = O.<primary key of the table>
ORDER BY K.RANK DESC
Example:
select * from organisation O, CONTAINSTABLE(Organisation, Description, 'internet OR intranet') AS K
WHERE K.[KEY] = O.OrganisationID
ORDER BY K.RANK DESC
Friday, December 7, 2007
Get DataBase info from queries
Get all SP names in a database
Simply run the below query under your database.
--Get all SP list of a DB
select name from sysobjects where type='p' order by name asc
Gt all Table of a DB
SELECT [A].* FROM [sysobjects] AS A where [Xtype] = 'U' order by [A].[name]
Gt all column names of a table
SELECT [syscolumns].* FROM [syscolumns], [sysobjects], [systypes] where [syscolumns].[ID] = [sysobjects].[ID] and [syscolumns].[xtype]=[systypes].[xtype] and [syscolumns].[id] = '<Table ID got from above query>' order by colid
Simply run the below query under your database.
--Get all SP list of a DB
select name from sysobjects where type='p' order by name asc
Gt all Table of a DB
SELECT [A].* FROM [sysobjects] AS A where [Xtype] = 'U' order by [A].[name]
Gt all column names of a table
SELECT [syscolumns].* FROM [syscolumns], [sysobjects], [systypes] where [syscolumns].[ID] = [sysobjects].[ID] and [syscolumns].[xtype]=[systypes].[xtype] and [syscolumns].[id] = '<Table ID got from above query>' order by colid
Subscribe to:
Posts (Atom)