用户表:
SELECT [Project1].[C1] AS [C1] , [Project1].[CatalogName] AS [CatalogName] , [Project1].[SchemaName] AS [SchemaName] , [Project1].[Name] AS [Name] FROM ( SELECT [Extent1].[CatalogName] AS [CatalogName] , [Extent1].[SchemaName] AS [SchemaName] , [Extent1].[Name] AS [Name] , 1 AS [C1] FROM ( SELECT QUOTENAME(TABLE_SCHEMA) + QUOTENAME(TABLE_NAME) [Id] , TABLE_CATALOG [CatalogName] , TABLE_SCHEMA [SchemaName] , TABLE_NAME [Name] FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ) AS [Extent1] ) AS [Project1] ORDER BY [Project1].[SchemaName] ASC , [Project1].[Name] ASC
视图:
SELECT [Project1].[C1] AS [C1] , [Project1].[CatalogName] AS [CatalogName] , [Project1].[SchemaName] AS [SchemaName] , [Project1].[Name] AS [Name] FROM ( SELECT [Extent1].[CatalogName] AS [CatalogName] , [Extent1].[SchemaName] AS [SchemaName] , [Extent1].[Name] AS [Name] , 1 AS [C1] FROM ( SELECT QUOTENAME(TABLE_SCHEMA) + QUOTENAME(TABLE_NAME) [Id] , TABLE_CATALOG [CatalogName] , TABLE_SCHEMA [SchemaName] , TABLE_NAME [Name] , VIEW_DEFINITION [ViewDefinition] , CAST(CASE IS_UPDATABLE WHEN 'YES' THEN 1 WHEN 'NO' THEN 0 ELSE 0 END AS BIT) [IsUpdatable] FROM INFORMATION_SCHEMA.VIEWS WHERE NOT ( TABLE_SCHEMA = 'dbo' AND TABLE_NAME IN ( 'syssegments', 'sysconstraints' ) AND SUBSTRING(CAST(SERVERPROPERTY('productversion') AS VARCHAR(20)), 1, 1) = 8 ) ) AS [Extent1] ) AS [Project1] ORDER BY [Project1].[SchemaName] ASC , [Project1].[Name] ASC