枚举 sql server 中的表名 (zz)

来源:互联网 发布:php substr函数 中文 编辑:程序博客网 时间:2024/06/06 00:32

//z 2012-3-16 11:34:36 AM IS2120@CSDN

SQL Server 2005 or 2008:

SELECT * FROM information_schema.tables

SQL Server 2000:

SELECT * FROM sysobjects WHERE xtype='U'


SELECT sobjects.nameFROM sysobjects sobjectsWHERE sobjects.xtype = 'U'

Here is a list of other object types you can search for as well:

  • C: Check constraint
  • D: Default constraint
  • F: Foreign Key constraint
  • L: Log
  • P: Stored procedure
  • PK: Primary Key constraint
  • RF: Replication Filter storedprocedure
  • S: System table
  • TR: Trigger
  • U: User table
  • UQ: Unique constraint
  • V: View
  • X: Extended stored procedure
//z 2012-3-16 11:34:36 AM IS2120@CSDN

SELECT * FROM INFORMATION_SCHEMA.TABLES 

or Sys.Tables



exec sp_msforeachtable 'print ''?'''
//z 2012-3-16 11:34:36 AM IS2120@CSDN
原创粉丝点击