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 VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
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
SQL 2016 DESIGN & PROGRAMMING
 
 
 
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