Databases Reference
In-Depth Information
OPTION (HASH JOIN)
OPTION ( OPTIMIZE FOR (@ProductCategory = 'Widget') )
CASE
CASE
evaluates one or more expressions and returns one or more specified values based on the evalu-
ated expression.
SELECT
expression
= CASE Column
WHEN value THEN
resultant_value
WHEN value2 THEN
resultant_value2
. . .
ELSE
alternate_value
END
FROM
table
SELECT
value
=
CASE
WHEN column IS NULL THEN
value
WHEN column {
expression true
} THEN
different_value
WHEN column {
expression true
} and price {
expression true
} THEN
other_value
ELSE
different_value
END,
column2
FROM table
INSERT
Adds a new row to a table:
INSERT table (column list)
VALUES
(column values)
INSERT table
SELECT columns FROM source expression
INSERT table
EXEC stored_procedure
UPDATE
Updates selected columns in a table:
UPDATE table SET column1 = expression1, column2 = expression2
WHERE filter_expression
Update a table based on the contents of another table:
UPDATE table SET column1 = expression
FROM table INNER JOIN table2
ON table.column = table2.column
WHERE table.column = table2.column
Search WWH ::
Custom Search