PDA

View Full Version : سوال: آیا در sql server می توان از شرط های تودر تو (if(if))) یا مرکب (if (a & b استفاده کرد؟



m.h.movahedi
پنج شنبه 11 آذر 1389, 14:09 عصر
سلام دوستان

آیا در sql server می توان از شرط های تودر تو (if(if))) یا مرکب (if (a & b استفاده کرد؟اگه میشه یه مثال بزنید.

..با تشکر..

hadi-z
پنج شنبه 11 آذر 1389, 14:43 عصر
بله


IF (@QuantityOrdered < (SELECT QuantityOnHand
FROM Inventory
WHERE PartID = @PartOrdered) )
BEGIN
-- SQL statements to update tables and process order.
END
ELSE
BEGIN
-- SELECT statement to retrieve the IDs of alternate items
-- to suggest as replacements to the customer.
END

m.h.movahedi
پنج شنبه 11 آذر 1389, 15:36 عصر
بله


IF (@QuantityOrdered < (SELECT QuantityOnHand
FROM Inventory
WHERE PartID = @PartOrdered) )
BEGIN
-- SQL statements to update tables and process order.
END
ELSE
BEGIN
-- SELECT statement to retrieve the IDs of alternate items
-- to suggest as replacements to the customer.
END




دوست عزیز منظورم if-else نیست منظورم if-if و if a& b هست