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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...