Hello friends
Here are few Database Specific Queries- Select All Database list
1: SELECT [name] FROM sys.databases
2: SELECT [name] FROM sys.sysdatabases
- Select All Tables of particular Database.
1: SELECT Name, type,type_desc FROM sys.objects
2: where Type='u'
- Here Fields Type and Type_Desc are
Type | Type_Desc |
C | CHECK_CONSTRAINT |
D | DEFAULT_CONSTRAINT |
F | FOREIGN_KEY_CONSTRAINT |
FN | SQL_SCALAR_FUNCTION |
IF | SQL_INLINE_TABLE_VALUED_FUNCTION |
IT | INTERNAL_TABLE |
P | SQL_STORED_PROCEDURE |
PK | PRIMARY_KEY_CONSTRAINT |
S | SYSTEM_TABLE |
SQ | SERVICE_QUEUE |
TF | SQL_TABLE_VALUED_FUNCTION |
TR | SQL_TRIGGER |
U | USER_TABLE |
UQ | UNIQUE_CONSTRAINT |
V | VIEW |
- Select Columns from particular Table
1: SELECT column_name as [Column Name],data_type as [Data Type],Character_maximum_length as [Character Maximum Length]
2: FROM information_schema.columns
3: WHERE table_name = 'table_1'
All The Best
No comments:
Post a Comment