DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to SELECT from system tables?

System tables are off limit starting with Microsoft SQL Server 2005. You can access the corresponding catalog views by placing a period after the "sys" schema. Examples:

SELECT * FROM sys.objects                -- new objects table

SELECT * FROM sys.sysobjects             -- SQL Server 2000 style objects table

 

SELECT * FROM sys.all_columns

 

SELECT * FROM sys.all_objects     -- system objects included also with user-defined

 

SELECT * FROM sys.all_parameters  -- stored procedure and function parameters

 

SELECT * FROM sys.all_sql_modules -- stored procedures, functions, triggers, app views

 

SELECT * FROM sys.all_views

 

-- SQL Server find all primary keys

SELECT SCHEMA_NAME(schema_id)        AS SchemaName,

       OBJECT_NAME(parent_object_id) AS TableName,

       OBJECT_NAME(object_id)        AS ConstraintName 

FROM   sys.objects

WHERE  type_desc IN ('PRIMARY_KEY_CONSTRAINT'


Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE