April 28, 2011 at 9:06 am
I have an application that I want to convert to a Web app. The Web needs a common ID to log in which works just fine. However, I still need to know the user ID of who is loggin in. So, to do this, I will need a login window in my app where I will capture the user ID of whomever is logging in - I can save this as a variable.
The problem I have is that I have a bunch views. These views are from tables that have a user_id field that I am joining with USER in the SQL statement for the view. The USER in the case is the generic
log on used to connect to the DB in the WEB - NOT the user that logged in to the app. Any ideas how to get around this?
For example, here is one of my views:
SELECT cust_no, cust_name
FROM dbo.RTO_CUSTOMER
WHERE (cust_no IN
(SELECT cust_no
FROM dbo.RTO_USER_CUST
WHERE (user_id = USER)))
I need the where clause to be where user_id = logging in user
April 28, 2011 at 9:14 am
In short...there is no way for SQL Server to retrieve information about the person logged into your web app. It only knows what login the web app used to authenticate to SQL Server and what security context that login is in within a particular database. There was just a lengthy thread where a couple of us ran down all the same issues you're having in your environment with someone else in a very similar situation. I think you'll find this thread very useful: http://www.sqlservercentral.com/Forums/Topic1097586-359-1.aspx
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply