January 8, 2022 at 9:40 am
I work on sql server 2017 I have issue
How to allow mutli user working on same table without using temp table
and without interact two user with same data
as example
user a :
exec sp_workingmultiuser 5
user b :
exec sp_workingmultiuser 10
create proc sp_workingmultiuser
@productid int
as
begin
select * into dbo.testtrade from parts.tradecodes
where productid=@productid
end
so my question if
user a
using product id 5
and
user b
using product id 10 on same time
data for user b will display for user a
so how to prevent that please ?
January 8, 2022 at 7:39 pm
data for user b will display for user a
If that's happening, then you've left something out of your post because, according to the code you've posted, it cannot happen.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 8, 2022 at 8:26 pm
What is the problem your trying to solve?
If you want data to be different in the table you need to either wait for 1 person to finish then delete the data for the next to come in and use the table fresh or use another filter on the temptrade table further down the code block, or use temp tables.
I guess the bones of that stored proc are much more meatier than you have provided so potentially a little more context may produce a better answer to your problem.
January 9, 2022 at 12:38 am
With that, I'll ask, are you really saying that you want to restrict the two users from seeing each other's products at any time and not just for the code example you posted? In other words, "Row Level" security?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 9, 2022 at 7:53 am
yes yes yes
January 9, 2022 at 10:22 am
January 9, 2022 at 3:12 pm
Another good link can be found here.
https://www.sqlshack.com/introduction-to-row-level-security-in-sql-server/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply