Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Maximum amount of "If" statements and "Select CASE" Expand / Collapse
Author
Message
Posted Tuesday, October 14, 2008 2:26 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, March 27, 2014 2:54 PM
Points: 212, Visits: 466
What is te maximum allowed nested "If" statements?
What is the Maximum allowed "CASE" in "Select CASE" statement.

I ask because I was using the MS SQL Server Migration Assistant an on one SP, I got the error saying...
"Errors: Some part of your SQL statement is nested too deeply."

Thanks
Post #585787
Posted Wednesday, October 15, 2008 6:34 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 3:34 PM
Points: 15,661, Visits: 28,051
It's 10 levels in a CASE statement (here's the page in the local Books Online). I don't know of a limit on IF statements, but I think it's reasonably safe to say, if you need to worry about the limit, you're probably approaching the problem in an inefficient manner and need to step back and rethink the solution.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #586129
Posted Wednesday, October 15, 2008 6:40 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 7:27 PM
Points: 33,204, Visits: 15,351
I agree with Grant. You might need to rethink the SP.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #586133
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse