cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hert6079
Engaged Sweeper
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!
1 REPLY 1
ErikT
Lansweeper Tech Support
Lansweeper Tech Support
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.