Use test
--Querying all tables and schema names in the database
Select Schema_name (schema_id) as Table_schema_name, NAME as table_name from sys.tables;
Select Table_schema,table_name from INFORMATION_SCHEMA. TABLES where table_type=n ' base TABLE '
--View table column information
Select Name as column_name,
Type_name (system_type_id) as Data_type,
Max_length,
Collation_name,is_nullable from sys.all_columns where object_id = object_id (N ' UserInfo ')
Select Column_name,data_type,character_maximum_length,collation_name,is_nullable from INFORMATION_SCHEMA. COLUMNS
--system stored procedures and functions
--Returns a list of objects in the current database through a stored procedure
EXEC sys.sp_tables
--Returns multiple result sets for object common information and columns, indexes, constraints, etc.
exec sys.sp_help @objname = ' UserInfo '
--Querying column information in a table
exec sys.sp_columns @table_name =n ' userInfo ', @table_owner =n ' dbo '
--return constraint information for an object
exec sys.sp_helpconstraint @objname =n ' Dbo.userinfo '
--Returns the version information for this instance
Select SERVERPROPERTY (' ProductLevel ')
--Returns the collation of the database
Select Databasepropertyex (' Test ', ' collation ')
--Returns the properties queried by the specified object for example: Querying the UserInfo table for a primary key
Select ObjectProperty (object_id (' UserInfo '), ' Tablehasprimarykey ')
--Returns the information queried by the specified column, such as whether the query username can be empty
Select ColumnProperty (object_id (' UserInfo '), ' UserName ', ' allowsnull ')
MS SQL Server Query metadata