Sql Server - View the structure of View

3

I ran the following commands on the Sql Server database:

comando 1:
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vendas'

resultado 1:
TABLE_CATALOG     TABLE_SCHEMA     TABLE_NAME      TABLE_TYPE    
----------------  ---------------  --------------  ------------- 
Empresa 1         dbo              vendas          VIEW

comando 2:
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'vendas'

resultado 2:
TABLE_CATALOG     TABLE_SCHEMA     TABLE_NAME      VIEW_DEFINITION     CHECK_OPTION     IS_UPDATABLE    
----------------  ---------------  --------------  ------------------  ---------------  --------------- 
Empresa 1         dbo              vendas          (null)              NONE             NO

comando 3:
SELECT definition FROM sys.objects O JOIN sys.sql_modules M ON M.object_id = O.object_id WHERE O.object_id = object_id( 'dbo.vendas') AND O.type = 'V'

resultado 3:
definition    
------------- 
(null)

My questions are

  • The table is even a view , or this is just a description for some other type of table Material

  • How to get more information about this table if it is a view , which tables do you build?

  • Lack of information from the definition could be a lack of user privilege, how to figure it out?

Edited:

The Microsoft documentation shows that the sys.sql_modules.definition column may be encrypted.

    
asked by anonymous 17.05.2017 / 17:06

1 answer

3
  

The table is even a view, or this is just a description for some other type of table Material

It's a view yes. If it is a description, it will depend on its content.

  

How to get more information about this table if it is a view, which tables do you build?

Use the sp_helptext vendas command.

  

Lack of definition information could be a lack of user privilege, how to figure this out?

Running the above command with a user without access permission will cause SQL Server to return an error message warning you of this lack of permission.

    
17.05.2017 / 18:09