SQL 2012 :: How To Delete User
Nov 3, 2014How can I delete user who own a schema in the database? The user is created by myself but I want this to be deleted.
View 2 RepliesHow can I delete user who own a schema in the database? The user is created by myself but I want this to be deleted.
View 2 RepliesI have a table 'library' with two columns
user_name, access_time
every user is having more than 500 entries, i want to keep only top 50 records for every user and delete the remaining records.
Hi,
I have several reports for users to view on our Intranet. After installation of SQL 2005 SP2 patch, I cannot delete user or user's authority from Report in Properties Tab. An error message was shown on the status bar. It indicated that JavaScript Error: 'Return' statement outside of function. Seems something wrong with the 'Delete' funciton in SQL 2005 after update. The other functions worked fine. Could you point me out how to fix it or need to install any updates / hotfix. Thanks a lot!
Regards,
Kenneth Lai
Programmer
Error Pic
Message Box
We were using sql authentication on our sql server 2000 servers, Butneed to use windows authentication. I have an sql user jdoe that ownsmany different objects in multiple databases. I have tried adding thewindows login of jdoe with the exact same permissions as the sql userjdoe, but it complains because it says jdoe already exists. So Iattempt to delete the sql user of jdoe (remembering the permissions soI can reapply them to the windows user soon to be created) But it says"you cannot drop the selected login id because that login id ownsobjects in one or more databases" So now I am trying to figure out howto change the ownership of those many many objects in the manydatabases from jdoe to dbo so I can delete this sql user of jdoe. Doesanyone know of a way to convert an sql login to a windows login? Or ifthat can't be done, how to change the owner of many objects to dbo so Ican delete this user? Maybe a T-SQL script or stored procedure. Thereis a stored procedure called sp_changeobjectowner but that only worksfor one object, how would I do that on all the objects that jdoe owns?As you can see I am a newbie but I appreciate any help you canprovide!!! Thanks in advance!
View 3 Replies View RelatedI would like to know if there is a way to find out who changed a users roles/access WITHOUT using the audit function. For example, if a user account was created and given SA access then changed to read only, how can I find out who made that change? I tried searching for an answer, but kept getting no results. I'm thinking this may tie into the sys.sysusers view?
View 3 Replies View RelatedI am relatively new to sql developer. There is a new user that just joined our organization. I am trying to grant him the same direct grants privilege to the tables that an existing user has. The existing user has a ton of direct table access privileges and it will take days if I had to do each grant one by one like: grant select,insert,delete,update on 'table name' to 'user id'. Is there a way of copying or inserting an existing user's privilege and granting it to a new user.
View 2 Replies View RelatedI have an SSIS package built by another developer, and now that I'm running it under my login the passwords won't save. The solution and packages are setup with ProtectionLevel EncryptSensitiveWithUserKey, but how do I get the User Key to reset so I can now save passwords? I can re-enter them, but whenever I enter hte password and test it then click OK it still has the red arrow next to the connection as if there's an error. I can create new connections and those passwords save fine, but with 40-50 items in this package I hate the thought of having to go into each and change the connection.
I tried changing the package and solution to DontSaveSensitive then rebuilding and closing then reopening, I hoped there was some option to reset the User Key just as if I created the solution. If this option doesn't exist why?
I am trying to recreate a user, using an NT account that changed.
First I got rid of the user using sp_dropuser, and this seemed to work. The user has certainly gone from the sysuser table. However when I try and create a new user it throws an error, telling me that the user already exists.
Any ideas?
hey, i'm trying to delete everything record that is connected to a user i want to delete..however, i've been getting error due to the fact that the username also serves as foreign keys..is there anyway i can solve this?
View 3 Replies View RelatedI created many test users in my application while trying to get a custom registration process to work, and now I would like to delete those users so they don't use up space in my database. When I go into the aspnet_Users table and try to delete a user, it gives me the following error:-------------------------------- DELETE statement conflicted with COLUMN REFERENCE constraint 'FK__aspnet_Me__UserI__0F975522'. The conflict occurred in database 'DB_83996', table 'aspnet_Membership', column 'UserId'.DELETE FROM [DB_83996].[dbo].[aspnet_Users] WHERE 1=0 OR ( [UserId] = '{7E864A07-6FE8-46EF-A2B8-354646D57C76}' )-------------------------------- I don't know much about SQL statements, so is that statement it gave me the statement I need to use to delete that particular user? If not, how would I go about deleting these users I don't need anymore?Thanks so much. :)
View 2 Replies View RelatedHello I am import a file into a SSIS package. Is there a easy way to delete duplicate user in the file. Could i use a sql task or something.
thanks
how can we drop an user from sys.server_principals . I did once before , but i forgot the sqls now
thanks
When trying to delete a user on SQL server 2000, we recieve the message "You cannot drop the selected login ID because that login ID owns objects in one or more databases."
We've tried a number of operations to find the objects owned by the user by searching for this error message in Google but, none of those suggestions work.
My questions are; Why does this happen, How can we avoid it in the future?
Our software applicaiton is case sensistive, and if a SQL security login is not created that matches the Domain login to the method used in the application - somehow we are suck. We can't create a new security for the login, nor can we delete or use the existing one.
Dear all
I would like to ask one sql question , it's that possible to use statement delete my columns ?
select * from tablename where columna = '--delete from tablename '
Good afternoon,
I have a little trouble with sql server 2005 express database:
customer need install new web application to hosting, but at hosting is currently exist other web application and it's using DB what I must use. DB contains a big number of tables, views, functions, etc.
I need delete all user objects from this DB, it must be as new created one.
Is any query whitch can do this?
PS: I know, best way for this is delete DB and create new one, but i haven't permissions for these.
Thank's for reply.
I have a database user (Maximum). Its default schema is db_datareader. It was created without a login name. When I try and delete this user, i get the following error message:
Drop failed for User 'maximum'. (Microsoft.SqlServer.Smo)
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
How do I remove this user?
Please help, it's urgent!!
We are using sql server 2000 DB,
Sa is trying to delete a user from the Great Plains application and got the follow error:
Deleting the login failed for an unknown reason, contact your sql server administrator for assistance.
My os:
Window2000 + SQL Server 2000 Enterprise
User BUILTINAdministrators was delete. I can't use SQL Enterprise Manager.
Thank you.
I am creating a Scheduled JOb that will delete backups older than 3 days old, however I seem to be missing something in my script.
DECLARE @DeleteDate datetime
SET @DeleteDate = DateAdd(day, -3, GetDate())
EXECUTE master.dbo.xp_delete_file 0,N'E:BackUps',N'bak',N' + @DeleteDate + ''
I want to know more details about the Clustered Index Delete. Is that Clustered Index Delete in the execution plan is good or bad or we can neglect that cost. Is there any way to avoid that clustered Index delete operator from the execution plan.
View 4 Replies View RelatedIs there anyway I can turn off delete in SQL server? I want to prevent anyone inadvertently deleting rows in tables. I thought worse case I could have triggers on tables to perform roll back.
View 3 Replies View RelatedI'd like to delete A3 from the XML variable below, however I get "XQuery [modify()]: The XQuery syntax '/function()' is not supported."
DECLARE @XML XML = '<Attribute>
<A1>6529</A1>
<A2>6529</A2>
<A3>6529</A3>
</Attribute>'
DECLARE @n VARCHAR(100) = 'A3'
SET @XML.modify('delete (/Attribute/sql:variable("@n")[1]) ')
SELECT @XML
I just started at a new job and they have DQS set up on our BI server. Some genius decided to delete [##MS_dqs_service_login##] login, the user dqs_service still exists in the DQS_Main db. The error log is full of errors similar to this one...
The activated proc '[internal_core].[ParallelExecutionActivator]' running on queue 'DQS_MAIN.dbo.ParallelExecutionRequestQueue' output the following:
'Cannot execute as the database principal because the principal "dqs_service" does not exist, this type of principal cannot be impersonated, or you do not have permission.'I have tried the standard exec sp_change_users_login 'Auto_Fix' with no success. At this point I don't think anyone is utilizing DQS.
I have a delete trigger on one table. When I delete a single row in this table that deleted record will be recorded to a history table.But sometimes my delete will delete more than one record. In this case also only one record is being recorded into the history table.How can I record all the deleted records into the history table when multiple records are deleted with one single delete statement?
View 4 Replies View RelatedHi,
I have been working around with SQL Server Express 2005 on VISTA. I created a small C++2008 application which interface with SSE 2005. When running my application, it automatically created a user instance which I would like to get rid of. I just forgot from start to set "User Instance = False" in my connectionstring. (oups...)
I'm aware, from readings I did, that a couple of tables as well as log files, etc. are created under directory "utilisateurs...AppDataLocalMicrosoftMicrosoft SQL Server DataSQLEXPRESS". SQLEXPRESS is the instance name chosen during install of SSE2005.
Also using following SQL Statement:
select owning_principal_name, instance_pipe_name, heart_beat
from sys.dm_os_child_instances
I got following result:
owning_principal_name: PC-DE-STEPHANEStéphane
instance_pipe_name: \.pipe6172F4E8-622E-4A sqlquery
heart_beat: dead (at this moment...)
==> How can I make a good cleanup of all this as well as get rid of the user instance itself?
Thanks in advance for any help.
Stéphane
I will try my best to explain this, We have a shopping cart on our website, the person that was developing this has now left the company and I've been given the job to finish it off.
When I load all the items that the user has entered in to his/her cart I return the Item ID and the RowNumber (ROW_NUMBER() OVER (Order by Id) AS RowNumber)
I'm trying to delete the item from the table using the following query
DELETE FROM [dbo].[Cart.Items] WHERE UniqueID = UniqueID and ItemID = @ItemID and @RowNumber IN (
SELECT ROW_NUMBER() OVER (Order by Id) AS RowNumber)
Now the reason we are using the RowNumber is because the user can add the same Item as many times as they like so for example you buy 3 different mobile phones, and you want three screen protectors, they will click screen protector 3 times which will add 3 records in to the db with the same id. so the row number is used to find the correct one.
But the above delete is not working.
I create a main program which will launch two jobs at a time, each job does some processes and at the end I'm trying to delete those jobs after storing the job details in one of the custom table I created (cleanup sub-program).
Out of two jobs I am able to store one job details (like job_name,job_id,start_time and end_time of the job) in the custom table and able to delete that job, but the job that's getting completed at the end is not getting captured nor getting deleted from sysjobs and sysjobhistory tables.
I had included this step (which will call the cleanup sub-program to store the job details and delete it) at the end. I can see that this cleanup procedure getting called from debug message but it is neither storing details nor deleting the job.
When I execute this cleanup program separately, it does store the job details and delete it.
I am using SQL 2012 SE. I have 2 databases say A and B with same structure and relationships. There are 65 tables in each database. A is already replicating data to database C for 35 tables. Now I need to move data from A to B which is greater than getdate()-1 everyday for all the tables and once the move is done I need to delete this data from A. And the same thing the next day and everyday. Since this is for 65 tables its challenging to identify the insert order. Once the insert order is identified the delete order will be the reverse of it.
Is there a tool or any SP that could generate the insert order script? The generate scripts data only is generating the entire data and these databases are almost 400GB. Some tables have 200Mil+ rows. So it takes forever.
Hello, I recently view a webcast of sql injection, and at this moment I created a user, and give dbo to this user, and this same user, is the one I have in the connection string of my web application, I want to create a user to prevent sql injection attacks, I mean that user wont be able to drop or create objects, only select views, tables, exec insert,update, deletes and exec stored procedures.
Is any easy way to do this?
A database role and then assing that role to the user?
I have an issue with Delete statement.In the code given below (its a part of actual proc),if we use TRUNCATE to clean the temp tables, everything goes fine.But if I use DELETE in place of truncate, system skips the IF loop 'if (@script_type = 1 OR @script_type = 2)'I am not able to understand this behavioral difference between DELETE and TRUNCATE.Recently the database is being used for replication, but that should not be a reason.
SELECT @max_rows = COUNT('X') FROM #temp_table1
SET@row_cnt = 1
WHILE @row_cnt <= @max_rows
BEGIN
[code],...
My requirement is before inserting new data, we need to delete the old data based on the input in 4 tables.
For this one I need to write 4 individual delete statements.
Is it possible to delete rows from multiple tables in single statement in SQL Server 2012 by using joins?
[URL] .....
I am looking similar, I tried by keeping 4 table aliases in delete statement but it is throwing synatx error
I have a table with about 466 Million rows. In this table there is a int column called WeeksToRetain as well as a EventDate column containing the date the row was inserted. I am trying to delete all the rows that that should be deleted according to the WeeksToRetain. For example, if the EventDate is 5/07/15 with a 1 in the WeeksToRetain column the row should be removed by 5/14/15. I am not sure what days SQL considers the beginning and end of the week. However the core issue I am having is the sheer mass of deletions I must do and log growth.
So I am trying to do the delete in batches. More specifically I want to load a temporary table with a million rows, then use the temporary table to load a sub temporary table with 100,000 rows and join this temporary table to the table I want to delete from looping through 10 times to get 1 million. The Logging.EvenLog table which is the table I'm trying to purge has a clustered index on EventDate (ASC). I would like to run this in a schedule job with enough time between executions for log backups to run.
DECLARE @i int
DECLARE @RowCount int
DECLARE @NextBatchDate datetime
CREATE TABLE #BatchProcess
(
EventDate datetime,
ApplicationID int,
[Code] .....
I have a table which has XML data, so it takes lot of time to delete it.
Here's the condition:
Archive all data older than 2 months and delete it.
What would be the good approach for this?