lankapala
asked on
t-sql row permssion
Hi,
I have create user "qry" and create table Sales.
I need to give access this user only sales year 2017, i don't want to show 2016<= sales.
How to do that?
Best regards
I have create user "qry" and create table Sales.
I need to give access this user only sales year 2017, i don't want to show 2016<= sales.
How to do that?
Best regards
ASKER
Sorry, i'm looking for give using table. i think we can use trigger,but not sure how
Does the user connect to db SQL login, or there is a login to a web based interface, and you want to restrict within the app?
Understanding how users access your data.
You could create an SQL login. Then on the database, only grant it access rights to the one table where the data is. On the rights level, you either grant a user rights to query data ir not. You can not limit what data they access .....
Hainkurt provided you the answer to pull/review ...
What are you looking for this user to do.with the data?
Understanding how users access your data.
You could create an SQL login. Then on the database, only grant it access rights to the one table where the data is. On the rights level, you either grant a user rights to query data ir not. You can not limit what data they access .....
Hainkurt provided you the answer to pull/review ...
What are you looking for this user to do.with the data?
Sorry, i'm looking for give using table. i think we can use trigger,but not sure how
there is no such thing like restrict a user to see only some data!
either you give select or not!
trigger cannot do such things...
maybe a stored procedure... but it is not easier than view solution...
creating a view and give select permission to that user looks only way...
ASKER
if i can do with view, i never asking question.
i knew it's possible, i saw some code do this trick. it's ok i will check and let you guys know.
i knew it's possible, i saw some code do this trick. it's ok i will check and let you guys know.
so what you are saying is you have a table sales
when you login with user usr1 and run
select * from sales
you get only sales from 2017
and you login with user other than usr1 and run
select * from sales
you get all records from sales...
is that what you want, without any proc/view?
when you login with user usr1 and run
select * from sales
you get only sales from 2017
and you login with user other than usr1 and run
select * from sales
you get all records from sales...
is that what you want, without any proc/view?
ASKER
yes
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
create view sales_2016 as
select * from sales where saleyear=2016;
and give select permission to the view instead of table