Deleting parent records with children

As mentioned earlier, you cannot create constraints by using automatically created columns in node and edge tables, and thus it is not possible to create foreign keys between these tables by using these columns. This means that you can delete a node, even if it is referenced in an edge table. For instance, the following code should work: the entry from the dbo.TwitterUser table with the UserId = 5 (@WienerSportklub) should be removed from the table, and two identical SELECT statements should return two different result sets, as shown in the following code:

BEGIN TRAN    SELECT t2.UserName    FROM dbo.TwitterUser t1, dbo.TwitterUser t2, dbo.Follows WHERE MATCH (t1-(Follows)->t2) AND t1.UserName = '@MilosSQL'; ...

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.