Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql truncate table referencing itself

-- Original:
UPDATE 'recursive' SET 'parent_id' = NULL WHERE 'parent_id' IS NOT NULL;
DELETE FROM 'recursive';

-- For Example:
UPDATE Items
	SET Items.ParentItemId = NULL 
    WHERE Items.ParentItemId IS NOT NULL;
DELETE FROM Items;
-- Or 
TRUNCATE TABLE Items;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #truncate #table #referencing
ADD COMMENT
Topic
Name
7+5 =