|
Dieser Artikel wurde manuell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen.
|
Übersetzung
Original
|
ISNULL (Transact-SQL)
Hinweis
|
|---|
|
|
A.Verwenden von ISNULL mit AVG
USE AdventureWorks2012; GO SELECT AVG(ISNULL(Weight, 50)) FROM Production.Product; GO
Dies ist das Resultset.
--------------------------
59.79
(1 row(s) affected)
B.Verwenden von ISNULL
USE AdventureWorks2012; GO SELECT Description, DiscountPct, MinQty, ISNULL(MaxQty, 0.00) AS 'Max Quantity' FROM Sales.SpecialOffer; GO
Dies ist das Resultset.
Description DiscountPct MinQty Max Quantity
--------------- ------------- -------- ---------------
No Discount 0.00 0 0
Volume Discount 0.02 11 14
Volume Discount 0.05 15 4
Volume Discount 0.10 25 0
Volume Discount 0.15 41 0
Volume Discount 0.20 61 0
Mountain-100 Cl 0.35 0 0
Sport Helmet Di 0.10 0 0
Road-650 Overst 0.30 0 0
Mountain Tire S 0.50 0 0
Sport Helmet Di 0.15 0 0
LL Road Frame S 0.35 0 0
Touring-3000 Pr 0.15 0 0
Touring-1000 Pr 0.20 0 0
Half-Price Peda 0.50 0 0
Mountain-500 Si 0.40 0 0
(16 row(s) affected)
C.Testen auf NULL in einer WHERE-Klausel
USE AdventureWorks2012; GO SELECT Name, Weight FROM Production.Product WHERE Weight IS NULL; GO