|
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 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.
|
|
Hi,
Every time I try to create a new user account in OIM, I get the error "This User ID already exists. Enter another User ID." regardless of any user id I try. When I tried to create a new organization, I got the error "DOBJ.INSERT_FAILED. Insert failed...
Started by user9284472 on
, 11 posts
by 8 people.
Answer Snippets (Read the full thread at oracle):
The log file contains the following errors....
I can login and view all records but I can't modify or create new records .
Did you also copy the .xldatabasekey from your previous environment?
-Kevin Yes, I copied .xldatabasekey after importing the tablespace .
|
|
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.
|
|
Is there a way to check if a a folder exists on the server using PHP Ftp functionality?
Started by Roland on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You could try ftp_chdir and check the result
For PHP 5:
is_dir('ftp://user:password@example.com/some/dir/path');
http://uk.php.net/manual/en_exists(), is_file(), and is_dir....
There is no 'exists' function for ftp connections in php.
|