2553
|
1 |
|
|
2 |
============
|
|
3 |
SQL Server
|
|
4 |
============
|
|
5 |
.. contents::
|
|
6 |
:local:
|
|
7 |
|
|
8 |
Informational schema
|
|
9 |
====================
|
|
10 |
|
|
11 |
::
|
|
12 |
|
|
13 |
SELECT * FROM sys.tables;
|
|
14 |
SELECT * FROM sys.views;
|
|
15 |
SELECT * FROM sys.indexes;
|
|
16 |
|
|
17 |
SELECT * FROM information_schema.tables;
|
|
18 |
|
|
19 |
Table stats
|
|
20 |
===========
|
|
21 |
|
|
22 |
Individual table::
|
|
23 |
|
|
24 |
EXEC sp_spaceused NAME;
|
|
25 |
|
|
26 |
All tables in a schema::
|
|
27 |
|
|
28 |
sp_msforeachtable 'EXEC sp_spaceused [?]';
|
|
29 |
|
|
30 |
List collations
|
|
31 |
===============
|
|
32 |
|
|
33 |
::
|
|
34 |
|
|
35 |
SELECT name, description FROM sys.fn_helpcollations();
|
|
36 |
|