Jump to content
  • 0

l2off Delete Account if not have character


Question

1 answer to this question

Recommended Posts

  • 0
Posted (edited)
-- Delete records where there is no corresponding name user_data
USE lin2db;
DELETE FROM ssn
WHERE NOT EXISTS (
    SELECT 1
    FROM [lin2world].[dbo].[user_data] AS world_data
    WHERE world_data.account_name = ssn.name
);
DELETE FROM user_auth
WHERE NOT EXISTS (
    SELECT 1
    FROM [lin2world].[dbo].[user_data] AS world_data
    WHERE world_data.account_name = user_auth.account
);
DELETE FROM user_info
WHERE NOT EXISTS (
    SELECT 1
    FROM [lin2world].[dbo].[user_data] AS world_data
    WHERE world_data.account_name = user_info.account
);
DELETE FROM user_account
WHERE NOT EXISTS (
    SELECT 1
    FROM [lin2world].[dbo].[user_data] AS world_data
    WHERE world_data.account_name = user_account.account
);

 


-- Check Existing account with character name
USE lin2world;
DECLARE @char_name NVARCHAR(50);

SELECT @char_name = char_name
FROM [dbo].[user_data]
WHERE account_name = 'root';


IF @char_name IS NOT NULL
BEGIN
    PRINT 'Existing account with character name: ' + @char_name;
END
ELSE
BEGIN
    PRINT 'No account with character name root found.';
END

 

Edited by SkyLord

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock