Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> equivalent SQL Server statements

equivalent SQL Server statements

From: Sanjana <Udaya.Murugan_at_gmail.com>
Date: 7 Feb 2006 05:51:24 -0800
Message-ID: <1139320284.301814.214540@g44g2000cwa.googlegroups.com>


I wanted to know the equivalent for the following Oracle queries in SQL Server perferably if I can get the data directly from a system table like in Oracle

  1. As part of this select we need the following to be returned Number of distinct values - Is there a system table which stores this value for any column Number of endpoints for the frequent value histogram. Average column size - Is there a system table which stores this value for any column Type of the column - this is available in information_schema.COLUMNS or syscolumns Number of endpoints for the height balanced histogram.

SELECT NUM_DISTINCT, NUM_BUCKETS + 1, AVG_COL_LEN, DATA_TYPE, (SELECT MAX (ENDPOINT_NUMBER) + 1 FROM ALL_TAB_HISTOGRAMS WHERE OWNER = ATC.OWNER AND TABLE_NAME = ATC.TABLE_NAME AND COLUMN_NAME = ATC.COLUMN_NAME) as NumEPs FROM ALL_TAB_COLUMNS ATC WHERE
OWNER = :1 AND TABLE_NAME = :2 AND COLUMN_NAME = :3; 2. As part of this query we need

	Index Name.
	Cluster factor.
	Number of Keys.
	Number of leaf pages.
	Uniqueness Information.
	Number of Columns.


SELECT UPPER (INDEX_NAME), CLUSTERING_FACTOR, DISTINCT_KEYS, LEAF_BLOCKS, BLEVEL, UNIQUENESS
FROM ALL_INDEXES WHERE
OWNER = :1 and TABLE_NAME = :2 AND LAST_ANALYZED IS NOT NULL; Received on Tue Feb 07 2006 - 07:51:24 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US