SQL for Smarties | SQL Programming Style | Trees and Hierarchies in SQL | SQL Puzzles and Answers | Data and Databases


Friday, May 04, 2007

Stored Procedures---Stacking IFs

SQL Apprentice Question
What is the proper syntax for stacking these IFs in a Stored Procedure???

Thanks in advance...


IF @Loan_Nbr IS NOT NULL
IF @MTM_Losses_Accrued IS NOT NULL
IF EXISTS ( SELECT 1 FROM [DMD_Data]..[UDF_WARRANTY] WARRANTY

Celko Answers
>> What is the proper syntax for stacking these IFs in a Stored Procedure <<


What the hell are you talking about?? IF-THEN-ELSE-ENDIF constructs in
any procedural programming language are nested or sequential. This
has nothing to why SQL. Don't you know how to program in ANY
language??!!

Please something that makes sense when you are sober

No comments: