Database List For The Currently Logged In User
Jul 11, 2004
I can get a list of all databases in SQL Server using
sqlText = "select name from sysdatabases order by name".
How can I get such a list for the currently logged in user only?
Thanks in advance
Harold Hoffman
View 1 Replies
ADVERTISEMENT
May 14, 2008
NOTE: I am talking about roles in my sql server - NOT in asp.net. I need to create a stored procedure that retrieves the roles that the currently logged in sql user has for a different database. I have the code that gets the roles for the user, but it only works if the user is in the database. I want to be in one database, and get the roles for a different database. I have tried using USE DATABASE, but this is not allowed in a store procedure.
View 10 Replies
View Related
Apr 22, 2000
How do I refer to the user logged on to the database?
I can refer to a table as dbo.tblApptDaily,
but how do I refer to
[current user].tblApptDaily?
Create Procedure "prcCreateApptDaily"
as
Create dbo.tblApptDaily
(ID int primary key, ApptTime datetime,
book1 numeric, book_Status1numeric default (0), PN1 varchar (50), ApptID1
int,...LastID int)
View 2 Replies
View Related
Jul 23, 2005
Dear GroupI wondered whether there's a function or script that will show mewhether a user is currently logged-on to a MSSQL 2000 database? I'musing SQL Authentication.Thanks very much for your help & efforts!Have a nice day!Martin
View 2 Replies
View Related
Mar 24, 2008
Hi,
I wanted to know How can i find out that with which user i am logged in. Is there any command to find out the same.
( like in oracle, we have command -- showuser, which will return the logged in user of your session).
Thanks in advance.
-- Chetan
View 5 Replies
View Related
Jun 14, 2006
Hi There
I am in the process of cosolidating sql servers.
One of them literally has hundreds of sql logins, obviously i need to clean these up, however i a not sure how to determine when a user last logged in ?
How can i find out the last login date of a user ?
Thanx
View 3 Replies
View Related
Apr 23, 2007
Hi!
I would like to select the 10 latest logged in users and then display them in a gridview-control....
But Iam not good at SQL, so I would really appreciate if someone could help me to write the select-part for this!!
(I use the database 'ASPNETDB.mdf', which is automatically created by VVD 2005 Express Edition)
View 2 Replies
View Related
May 14, 2007
Hi all
I've been having a really difficult time finding out how to run a query which selects records from an SQL database for the current logged on user. I've tried a whole manner of different approaches but here is where I am at now:
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Page.IsPostBack Then
ds_meobservingcolleagues.SelectParameters(0).DefaultValue = User.Identity.Name
End If
End Sub
</script>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ds_meobservingcolleagues">
</asp:GridView>
<asp:SqlDataSource ID="ds_meobservingcolleagues" runat="server" ConnectionString="<%$ ConnectionStrings:StPaulsDatabase %>"
SelectCommand="SELECT [observeTeacher], [observeBy], [observeReason] FROM [Observations] WHERE ([observeBy] = @observeBy)">
<SelectParameters>
<asp:Parameter Name="observeBy" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
This is not resulting in any error. But it is not returning the records that it should be either.
Please can anyone help? I'm sure it shouldn't be this difficult to do
View 3 Replies
View Related
Sep 28, 2007
Hello.I realize that this question has been asked before, but I still can't get it to work. Below are some links that might be of help:http://forums.asp.net/p/1159666/1913519.aspx#1913519http://forums.asp.net/p/1161930/1924264.aspxhttp://forums.asp.net/p/1116601/1732359.aspx#1732359http://forums.asp.net/t/1104718.aspxhttp://forums.asp.net/p/1096290/1655706.aspx#1655706http://forums.asp.net/p/1110162/1707952.aspx#1707952 Basically, I need a DropDownList to display only projects for which the logged in user is assigned as leader. The [Projects] table contains an integer ProjectId, a string ProjectName, a uniqueidentifier ProjectLeader, and other fields. Can someone help me with the SQL query and code? * Here is the definition of the SqlDataSource: <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDB.MDFConnectionString %>" SelectCommand="SELECT [ProjectId], [ProjectName] FROM [Projects] WHERE ([ProjectLeader] = @Leader)" OnSelecting="SqlDataSource5_Selecting"> <SelectParameters> <asp:Parameter Name="Leader" Type="Object" /> </SelectParameters> </asp:SqlDataSource> * Here is the definition of the SqlDataSource5_Selecting method: protected void SqlDataSource5_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { e.Command.Parameters("@Leader").Value = loggedInUserId; } where loggedInUserId is a global variable of type System.Guid. It has been evaluated in the Page_Load event to as: loggedInUserId = (System.Guid)Membership.GetUser().ProviderUserKey; Now the first problem I encounter is that when I run the page, the compiler complains and says, "error CS0118: 'System.Data.Common.DbCommand.Parameters' is a 'property' but is used like a 'method'." The second problem is when I insert the line: SqlDataSource5.SelectParameters("Leader").DefaultValue = loggedInUserId; in page_Load. The compiler again says, "error CS0118: 'System.Data.Common.DbCommand.Parameters' is a 'property' but is used like a 'method'." I've spent a long time trying to figure it out, but could not solve it. I would appreciate it if someone can help me out. Thank you very much.
View 11 Replies
View Related
Mar 17, 2014
I have created a SharePoint external list using SQL Server, the data source is SQL Server. Is there way that I could get the logged-in SharePoint user and stored in SQL Seever?
View 2 Replies
View Related
Jan 20, 2015
I need to get the computer details of the person that logged in. I have a client that needs me to write a computer asset logging system for them. This is a one table database that will keep all the computers in the company's details like serial number, bios serial number, ram size disk size, mother board info etc. This is a vast number of details and what they want to do is when for instance the ram changes e.g. taken out or added they need the program to update the table with the new information once the computer starts again.
View 4 Replies
View Related
Nov 20, 2015
I have created table called Login in sql server where i have column usercode, email and login_date (login_date is datetime type)So, i created web application using .net. whenever user logged in, i am allowing based userLoged table and i am inserting into login table.
login table usercode email login_date
001 a@gmail.com 2015-11-18 22:02:41.153
001 a@gmail.com xxx
.
.
.
I have another table called userLoged where i have column usercode,email and web_access
UserLoged table usercode email web_access
001 a@gmail.com Y
Now, if a@gmail.com (001) is not logged in for 45 days, i need to update web_access to be 'N' how to know if he /she not logged for 45 days.
View 4 Replies
View Related
Feb 25, 2008
Assume I have a heirarchy like the following:
- John Smith
- James Jones
- Robert Allen
- Lisa Andrews
- Bob Thompson
Now, I have a report where whoever is logged in will only see data for themselves and those below them, so John Smith would see everyone including himself, but Lisa Andres would only see herself and Bob Thompson. James Jones would be able to see everyone except John Smith.
How do I go about implementing this code, for example in an asp.net page where one of the user's logs on to view the report. Currently, there is a T-SQL function that creates a user heirarchy table, but it is very slow and I am curious if SSRS 2005 has any new capabilities in handling this.
Thanks,
Saied
View 3 Replies
View Related
Mar 10, 2008
Is this level of security possible in RS 2005? if so how?
Any guidance would be appreciated.
Thanks.
View 1 Replies
View Related
Mar 27, 2006
Hello
how can i get current logged windows user name in tsql. I know with windows aut it is possible how can i get this when sql auth.
Is there any system function or any special codeing required ?
regards
Chikuu
View 8 Replies
View Related
Dec 11, 2007
Hi,
I'm new to ASP.NET 2.0. I'll like to ask how do one save user input from txtbox, radiobttnlist or checkboxlist into database?
Im implementing a suvrey form here by the way.
-any reference webs,
-any pointers from experts?
Thank you for your time in reading this email
Kayln
View 7 Replies
View Related
Feb 11, 2008
How do I insert the UserName of the Logged in user into the DB field UserID. I created a web form page, and added a form view control set the page default to Insert Mode. The Page is used to insert data. I have a hidden field called UserID that I would like to capture the Logged in user. I have logged in to the default page with userID and password, added a new record, and the db table field UserID is empty. I have been trying to figure out what I am doing worng, but no luck, Please suggest the best way to do this. I have listed what I have done thus far?
I have added the login Control from Login and added it to the page as a hidden field thinking that I needed to have this field on the page to get this to work where you copy the value in the Loginname field to the useridTextbox on the formview1 insert template. I read on line where the method below is better. Please tell me what I am doint wrong.
System.aspx---------------------------------------------------------------------------------------------------------------1) <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="SystemID" DataSourceID="SystemSqlDataSource1" DefaultMode="Insert" Width="583px">2) <asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' Visible="False"></asp:TextBox><br />3) <asp:SqlDataSource ID="SystemSqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RCMISConnectionString %>" DeleteCommand="DELETE FROM [tblSystem] WHERE [SystemID] = @SystemID" InsertCommand="INSERT INTO [tblSystem] ([SystemID], [SystemDesc], [Inactive], [TimeStampEntry], [TimeStampUpdate], [UserID]) VALUES (@SystemID, @SystemDesc, @Inactive, GETDATE(), @TimeStampUpdate, @UserID)"4) <InsertParameters> <asp:Parameter Name="SystemID" Type="String" /> <asp:Parameter Name="SystemDesc" Type="String" /> <asp:Parameter Name="Inactive" Type="Boolean" /> <asp:Parameter Name="TimeStampEntry" Type="DateTime" /> <asp:Parameter Name="TimeStampUpdate" Type="DateTime" /> <asp:Parameter Name="UserID" Type="String" /> </InsertParameters> </asp:SqlDataSource>System.aspx.vb---------------------------------------------------------------------------------------------------------5) Partial Class MemberPages_RCM_frmSystem Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'UserIDTextBox.Text = Membership.GetUser().ProviderUserKey.ToString() End Sub Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs) Handles FormView1.ItemInserted 'Set the UserID Value to the currently logged on user's ID e.Values("UserID") = Membership.GetUser().ProviderUserKey End SubEnd ClassThank you in advance,
View 7 Replies
View Related
Oct 15, 2001
How to find out the list of all tables and views owned by a particular user in any database by querying the system tables?Thanks.
View 2 Replies
View Related
Apr 24, 2007
Hi,
I have some sensitive and non-sensitive info/fields in one of my reports. Is there a way to hide/show the info based on the logged in user? or do I have to create separte reports for each type of info like one for sensitive and another one for non-sensitive info.
Thanks inadvace for your help!
View 3 Replies
View Related
Aug 7, 2007
We are using Windows authenication within our system, and I was wondering how it would be possible to determine if the user conected to the SQL SERVER instance was a member of a particular active directory security group?
Thanks.
View 3 Replies
View Related
Dec 30, 2014
How to find the list of queries currently running in the Database with User Login Information.
Since my database application is running slow, to find the slow queries.
View 8 Replies
View Related
Dec 20, 2007
I have 2 sql server 2000 database that participate in log shipping.Server A is the source database, which log ships to a database onServer B. The database on Server B is in a warm stand by/read onlymode. Is there a way that I can add users to the database on ServerB, without having to add the users to the database in server A? I amtrying to use the database on Server B as a reporting only databaseand add more users to have permissions to run reports.Please let me know if anyone has any suggestions. Thank you.
View 2 Replies
View Related
Apr 20, 2006
How does one Determine the number of Active users logged into a SQL Server Database?
I want to use the info to control concurrent licensing for my Application
View 6 Replies
View Related
May 22, 2008
Hi,
Please give the T-SQL script for this ? Thanks
Shanth
View 4 Replies
View Related
Mar 20, 2002
Recently found a situation which I can not figure out the cause. Wish somebody can help me here.
The scenario is as follows:
Server: SQL 7.0 with SP2
login name: DBA, standard SQL login, member of sysadmins
DB Name: TEST
DBA is the owner of database TEST and a member of db_owners in the database. Using EM, if you look at Users in TEST database, the only entry you can find is DBA where both Names (user name Login Name) are the same: DBA. There's no entry for user dbo. (from BOL, dbo can not be deleted)
Run sp_helpuser gives out two rows.
user login name
dbo NULL
DBA DBA
I don't know what happened to this machine before. Any clue about the possible cause is highly appreciated.
Hong
View 1 Replies
View Related
Apr 14, 2001
I'm brain-dead today, sadly. If it weren't for IE remembering previous entries, I don't know if my name and email would have made it into the header correct :-)
I want the SQL command that lists the names of all user tables.
Alternatively, I have the following problematic Access 2000 code:
Public Sub ListAllTables()
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim cnn As New ADODB.Connection
Dim i As Integer, j As Integer
Dim vgRet As Variant
Dim intPrefixLen As Integer
Dim strAppend As String
DoCmd.Hourglass True
cnn.Open CurrentProject.Connection
cat.ActiveConnection = CurrentProject.Connection
intPrefixLen = Len(CON_pkgPrefix)
Debug.Print cat.Tables.Count
For j = (cat.Tables.Count - 1) To 0 Step -1
Set tbl = cat.Tables(j)
With tbl
Debug.Print tbl.Name
vgRet = SysCmd(acSysCmdSetStatus, tbl.Name)
End With
Next
Set tbl = Nothing
Set cnn = Nothing
Set cat = Nothing
DoCmd.Hourglass False
vgRet = SysCmd(acSysCmdSetStatus, " ")
End Sub
This code runs fine against an MDB but against SQL it includes all the views, rather than just the tables. If you have a fix for this, that will do just fine!
Arthur
View 1 Replies
View Related
Apr 28, 2006
Hi, Does anyone has a script to get user permissions on all tables?
Thanks
View 8 Replies
View Related
Jun 15, 2006
Is their any sql to find the list of sp created by user's in master db?
View 9 Replies
View Related
Feb 11, 2008
Hi there,
Don't know if anyone has done this before -and I would really be wondered if not-:
I want to show a list of available reports to a user. Since we are working with SharePoint Portal Server 2003 the webparts can't be used (need MOSS 2007 or WSS 3.0), but I really need to be able to build a dynamically generated list and show it on a sharepoint page.
My first idea is to build a report (kind of menu). I am already this far:
to get a list of reports with the active directory groups and their mapped roles:
select u.UserName, c.Path, r.RoleName
from PolicyUserRole pur
left join Users u on pur.userID=u.userID
left join Roles r on pur.roleID=r.roleID
left join Catalog c on pur.policyID=c.policyID
order by u.UserName, c.Path, r.RoleName
I managed to link active directory via LDAP - linked server.
I even managed to get a list of users and groups. Unfortunately I cannot check whether a user belongs to a group (any idea?), since all of our security (on sql server) is managed by active directory groups this really is a problem.
Or am I completely wrong and is there another way to fetch a list of reports for a user?
Any help would be great!
Thanks,
Tom
View 1 Replies
View Related
Jun 1, 2007
Hi there,
Can someone please help me how to generate the list of all "user" in a database and it's access role? really need it . .
Thanks
View 3 Replies
View Related
Aug 27, 2004
Is there anyway, that I can generate a list of all the objects that a given user has access to (including type of access whether select or update etc), by running a SQL command? One of our databases has nearly 40,000 tables (no kidding!) I can always find this out by manually looking into the roles etc on the enterprise manager, but I need a way to find out using a T-SQL query..Thanks for any help!
View 2 Replies
View Related
Nov 17, 2014
Any way to list all databases that a user has access to?
View 6 Replies
View Related
Nov 27, 2013
I have 3 tables, please find the table structure and sample data below
Table 1 : tblUserInfo
UserID | FirstName | Email | JoinedDate
1 Testuser01 User01@User.com 10-10-2013
2 Testuser10 User10@User.com 11-10-2013
3 Testuser20 User10@User.com 11-10-2013
Table 2 : tblOffers
OfferID | OfferName | ExpiryDate
1 OfferSample1 15-10-2014
2 OfferSample2 15-9-2014
3 OfferSample3 10-07-2014
Table 3 :tblOfferActivated
ActivationID | UserID | OfferID | ActivationCode | ActivatedDate
1 2 3 ABC 11-11-2013
2 2 1 CEG 13-11-2013
3 3 1 JHG 18-11-2013
4 3 2 KIU 20-11-2013
Expected Output
I want to list out the users with the first activated offer details.The OfferName Should be based on the first activated date
UserID | FirstName | Email | JoinedDate | OfferID | OfferName |ActivatedDate | ActivationCode
1 Testuser01 User01@User.com 10-10-2013 Null Null Null Null
2 Testuser10 User10@User.com 11-10-2013 3 OfferSample2 11-11-2013 ABC
3 Testuser20 User10@User.com 11-10-2013 4 offerSample3 18-11-2013 JHG
View 6 Replies
View Related