
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2020 02:45 PM
Hi folks,
Exactly what needs to be true (or not true) about any given user for me to be able to delete them via SQL maintenance tool? I am attempting to delete a bunch of users using the following statement:
DELETE FROM htblusers WHERE email not like '%something.ac.uk' and email not like '%something.co.uk' but am running into the following error:
The DELETE statement conflicted with the REFERENCE constraint "FK_htblhistory_htblusers". The conflict occurred in database "lansweeperdb", table "dbo.htblhistory", column 'userid'.
The statement has been terminated.
I assume this means there is a related entry in another table; I have ensured there are no tickets for any users which would be captured in the statement but I guess it's more than that?
Cheers in advance!
Exactly what needs to be true (or not true) about any given user for me to be able to delete them via SQL maintenance tool? I am attempting to delete a bunch of users using the following statement:
DELETE FROM htblusers WHERE email not like '%something.ac.uk' and email not like '%something.co.uk' but am running into the following error:
The DELETE statement conflicted with the REFERENCE constraint "FK_htblhistory_htblusers". The conflict occurred in database "lansweeperdb", table "dbo.htblhistory", column 'userid'.
The statement has been terminated.
I assume this means there is a related entry in another table; I have ensured there are no tickets for any users which would be captured in the statement but I guess it's more than that?
Cheers in advance!
Labels:
- Labels:
-
General Discussion
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 08:39 AM
Hi Adam,
The delete statement is not working because htblusers is linked to htblhistory. You'll first need to determine the userid from htblusers and delete all entries from htblhistory wit that userid.
Afterward you can delete the entries from htblusers.
The delete statement is not working because htblusers is linked to htblhistory. You'll first need to determine the userid from htblusers and delete all entries from htblhistory wit that userid.
Afterward you can delete the entries from htblusers.
