AnsweredAssumed Answered

EPDM -  Trying to use a SQL list to return the logged in user

Question asked by Steven Richmond on Jun 12, 2015
Latest reply on Jun 12, 2015 by Jeff Sweeney

Hi .


I've been trialling a SQL list to select the current logged in user. This is due to having a Yes/No situation and me wanting someone to sign off their own name and not select someone else if the answer is Yes in another variable

I used the query below:-


select UPPER(username) from LoggedInUsers

where login_time >= DATEADD(day,DATEDIFF(day,0,GETDATE()),0) AND login_time < DATEADD(day,DATEDIFF(day,0,GETDATE()),1)

and hostname = host_name()

group by username

order by username


This works fine on my PC as it only brings up my name. However, if someone else runs the query on their machine, it picks up the current logged in user for my machine it doesn't select the user he is logged in as. I have the list set up to refresh every minute.


Is there any reason why the list is saving the query of the PC that it is created and saved on rather than be run when the list is selected? Is there any other way to have a list that contains only the name of the current logged in user?