How to make a user in SQL Server 2008 only view a VIEW?

4

I made a View to send to a client, but I can not pass the general login and password for it. That way I created a user ( cliente_view ) and I would like it to only view the created View (sales_view_view).

  • How to do this process above?
asked by anonymous 26.06.2017 / 13:29

2 answers

1

You need to give this user who created ( cliente_view ) the privilege you want, in your case, to give access only to SELECT permission, use GRANT :

GRANT SELECT ON view_consulta_vendas TO cliente_view;

Note: Because you already created the user, check what permissions he already has, if you want to remove some, use REVOKE .

    
26.06.2017 / 14:18
1

As per the help of the above personnel, I was able to create the Login to the Database, create the user and associate with the login above and allow that user to view only that particular view with the following commands:

-- Criando Login para o SQL:
CREATE LOGIN cliente_view WITH PASSWORD = 'cliente123'
-- Comando para selecionar o sistema:
USE SISTEMA_CLIENTE
-- Criando o usuário e associando ao login criado no processo acima:
CREATE USER cliente_view for login cliente_view
-- Liberando permissão para visualização da View pro usuário criado:
GRANT SELECT ON view_consulta_vendas_cliente TO cliente_view

    
26.06.2017 / 14:48