Documentation Home

Tip

All examples used are valid against the Microsoft Northwind Sample Database You can run the resulting SQL from the examples against Northwind in order to test and play with the SqlObjects library.

DELETEΒΆ

Basic Delete

var sql = TSQL

    .DELETE().FROM("Categories")
    .WHERE("CategoryID").IsEqualTo(9)
    .Build()

;

Console.WriteLine(sql);

Output:

DELETE FROM [Categories]
WHERE 1=1
 AND [CategoryID] = 9

Basic Delete with Table Schema

var sql = TSQL

    .DELETE().FROM("dbo", "Categories")
    .WHERE("CategoryID").IsEqualTo(9)
    .Build()

;

Console.WriteLine(sql);

Output:

DELETE FROM [dbo].[Categories]
WHERE 1=1
 AND [CategoryID] = 9