|
There’s not standard way to check if a MySQL user exists and based on that drop it. Are there any workarounds for this?
Edit: I need a straight way to run this without throwing up an error
e.g.
DROP USER test@localhost; :
Started by Cherian on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Drop_user_if_exists () BEGIN DECLARE foo BIGINT DEFAULT 0 ; SELECT COUNT(*) INTO foo'@'localhost' ; END IF....
Drop_user_if_exists ; DELIMITER $$ CREATE PROCEDURE databaseName .
DROP PROCEDURE IF EXISTS databaseName .
|
|
I need to check if a specific user already exists on the SQL Server, and if it doesn't, then I need to add it.
I have found the following code to actually add the user to the database, but I want to wrap this in an IF statement (somehow) to check if the...
Started by Brett Rigby on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
IF NOT EXISTS( SELECT name FROM [master].[sys].[syslogins] WHERE NAME = 'user') BEGIN --create login IF NOT EXISTS (SELECT name FROM sys.database_principals WHERE name = 'Bob') BEGIN CREATE USER [BobFrom here
If not Exists....
|
|
I have two questions.
1) How do I know if a 'user account' is exists on my windows OS (vista)? I need this information of a stand alone machine. I mean, the machine doesn't joined to any domain.
2) also I want to know whether a user is a part of a group...
Started by rainbow365 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You can work out if a local account exists through the System.Security.Principal(SecurityIdentifier)); bRet = id.IsAccountSid(); } catch (IdentityNotMappedException) { /* Invalid user it for the current user using the ....
Be wrong.
|
Ask your Facebook Friends
|
I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person.
How can I validate whether this Person exists or not?
Instead of...
Started by Marcus on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You can also search across profile information so you can pull back in Users.selectNodes("tns:User")) { string Login = current.attributes.getNamedItem("LoginName").text; Login:root/my:config/my:User"....
Scope for the specific user.
|
|
I have an application that checks to see if a USER exists (if not create it) every time it starts, this is done as follows:
bool bUserExists = false; DirectoryEntry dirEntryLocalMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer...
Started by Shaitan00 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Net user | find "username" /c
You want to use"); bool UserExists = dirEntryLocalMachine.Children.Find(userIdentity, "user") != null;
The following.
In a command prompt returns 1 if 'username' exists.
|
|
A user's login/account information was deleted and is no longer listed under "accounts" in System Prefs on the Mac OS X Client.
Their home folder is still present in /Users/
Anyone know what happens if we just create a new user with the same name? Will...
Started by Meltemi on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at serverfault):
Once the user is made, remove....
As long as the user doesn't login it's likely.
You're probably safe just adding the new user and then changing the ownership on the old home directory.
It encounters a pre existing home directory.
|
|
I am working on an internal web application that will use predefined SharePoint groups for determining a user's security level. I have done some research and found SharePoint's "usergroup" web service which has the method "GetUserCollectionFromGroup()...
Started by Josh on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
HTH
public static bool UserIsInGroup(SPUser user, SPGroup group) { try { using (SPSite site example on how to get users from....
This includes checking any member machine.
The code below will check if the user is in a particular group.
|
|
I want to add users in same role in more than one database. However the role can/cannot be present in all the database. How can i check if the role exists in database and if it does add users in that role?
e.g. IF role exists BEGIN Add user in role END...
Started by sanjeev40084 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Try:
IF DATABASE_PRINCIPAL_ID('role') IS NULL BEGIN -- add user here CREATE ROLE role AUTHORIZATION MyUser; END
IF EXISTS ( SELECT 1 FROM sys.database_principals WHERE type_desc = 'DATABASE_ROLE' AND name = 'name' ) BEGIN -- add user....
|
|
Edit: using SQL Server 2005.
I have a query that has to check whether rows from a legacy database have already been imported into a new database and imports them if they are not already there. Since the legacy database was badly designed, there is no ...
Started by Dennis on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If I had to guess, I'd say t1.printed....
If there's no indexes its likely doing multiple full table scans .
That should show you where the database is chewing up its time .
Not knowing what the schema looks like, your first step is to EXPLAIN those sub-queries .
|
|
This is a pretty simple Django question, but I can't find the answer in the Django docs, despite lots of hunting!
How do I check whether an object already exists, and only add it if it does not already exist?
Here's the code - I don't want to add the ...
Started by AP257 on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
existing_follow_role = UserToUserRole.objects.filter(role='follow').get() if existing_follow_role model manager:
role, created = UserToUserRole.objects.get_or_create( from_user=current_user, to_user=....
exists.
|