Browse by Tags

SQL Server TSQL to find complete CONSTRAINT information on a table catalog?
Published 9 January 8 7:26 AM | SSQA.net
I have had a requirement to see a detailed information about a constraint on a table that includes table fields, type, rules, referenced table and fields for FOREIGN KEYs, etc. Found this useful TSQL to get such information: SELECT k.table_name, k.column_name...
SQL Server- TSQL to see which object reside under which file groups?
Published 24 December 7 4:40 AM | SSQA.net
To continue the FIND-FilegroupFull post on the filegroups, here is the most common question on the forums to get which object reside under which filegroup if there are multiple ones associated: select si.rows as 'Rows', SO.Name as Table, SI.name...
SQL Server 2000 - list the current Statistics names that exist on a table
Published 5 November 7 9:0 AM | SSQA.net
Using Query Analyzer you can list an execution plan for a query , where you can find/get any statistics that are missing for that query. So to see the create missing statistics you will get further information such as Statistics name and so on and further...
TSQL to return internal table columns and column data types?
Published 1 November 7 9:26 AM | SSQA.net
SELECT SCHEMA_NAME(itab.schema_id) AS schema_name ,itab.name AS internal_table_name ,typ.name AS column_data_type ,col.* FROM sys.internal_tables AS itab JOIN sys.columns AS col ON itab.object_id = col.object_id JOIN sys.types AS typ ON typ.user_type_id...
TSQL to check whether the table has a column with the specified name?
Published 19 September 7 5:51 PM | SSQA.net
Within SQL Server 2005: if Exists( select * from sys.columns where Name = N '<ColumnName>' and Object_ID = Object_ID ( N '<TableName>' ) ) begin --write your own code print relevant code columns for existence end else begin...