Avatar of hidrau
hidrau
Flag for Brazil asked on

How to create a user and allow it only to see some views in mssql 2008?

Hello guys,

I need to create a user and allow it only to see some views,

How could I do that?

thanks
Alex
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
hidrau

8/22/2022 - Mon
SOLUTION
Pawan Kumar

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
hidrau

ASKER
Hi,

My loggin is sa

I did this way:

USE [master]
GO
CREATE LOGIN [alexteste] WITH PASSWORD=N'aqz1973aqz', DEFAULT_DATABASE=[HermesQualidade1], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
GRANT SELECT ON Schema.ApuracaoImpostos TO [alexteste]
GO
GRANT SELECT ON Schema.ApuracaoImpostosUF TO [alexteste]
GO

and got this message:

Msg 15151, Level 16, State 1, Line 5
Cannot find the object 'ApuracaoImpostos', because it does not exist or you do not have permission.
Pawan Kumar

ApuracaoImpostos - Is this View / Table ? This is not created .
hidrau

ASKER
it is a view
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Vitor Montalvão

My loggin is sa
sa is an administrator user. You don't need to give him extra permissions as he has administrative rights, meaning that he can access everything in SQL Server.
hidrau

ASKER
Ok,

I have four database named:

House
StoreHouse
StoreShop
Store

I want to create a user that can login only in house database
and can see only two views

this is my hard task today.
I created a user in my MASTER
I gave to the new user only the house database permition to open it
But it can see all the tables and views :(
ASKER CERTIFIED SOLUTION
Vitor Montalvão

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
hidrau

ASKER
thanks a lot
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.