List all user tables in the current library

zhaozj2021-02-16  55

- List all user tables in the current library SELECT table name = namefrom sysobjectswhere = 0 = 'u' and status> = 0

- List all system tables in the current library Select table name = namefrom sysobjectswhere xtype = 's'

- List all the views in the current library SELECT table name = namefrom sysobjectswhere = '=' v '

- List all user views in the current library SELECT table name = namefrom sysobjectswhere xtype = 'v' and status> = 0

Xtype = 'u'

Xtype = 's'

- Call the stored procedure you said to be implemented, to query the Pubs library as an example of USE Pubsgo

- List system tables EXEC SP_TABLES NULL, DBO, PUBS, "'System Table'"

- List user tables EXEC SP_TABLES NULL, DBO, PUBS, "'TABLE'"

- List views EXEC SP_TABLES NULL, DBO, PUBS, "'View'"

转载请注明原文地址:https://www.9cbs.com/read-17721.html

New Post(0)