1: Get all the user tables in the current database
Select Name from sysobjects where xtype= ' u ' and status>=0
2: Get all the fields of a table
Select name from syscolumns where id=object_id (' Table name ')
3: View the views, stored procedures, functions associated with a table
Select a.* from sysobjects A, syscomments b where a.id = b.ID and b.text like '% table name '
4: View all stored procedures in the current database
Select name as stored procedure name from sysobjects where xtype= ' P '
5: Querying all databases created by the user
SELECT * FROM Master. sysdatabases D where Sid not in (select Sid from Master. syslogins where name= ' sa ')
Or
Select dbid, name as Db_name from master. sysdatabases where Sid <> 0x01
6: Querying the fields and data types of a table
Select Column_name,data_type from Information_schema.columns
WHERE table_name = ' table name '