Home Dashboard Directory Help
Search

Add MAXINT() and MAXBIGINT() as a static definitions to TSQL by Dave Dustin (AucklandSQL)


Status: 

Closed


4
0
Sign in
to vote
Type: Suggestion
ID: 794356
Opened: 7/18/2013 2:30:40 AM
Access Restriction: Public
0
Workaround(s)
view

Description

There are numerous instances where you need to specific a maximum upper boundary when working with integer ranges.

At present, we need to manually enter the maximum possible value as a "textual" value into the code.

Having a built in static would make code more maintainable and readable, as well as providing compatibility with other programming languages.


Details
Sign in to post a comment.
Posted by Microsoft on 11/1/2013 at 10:49 AM
Thank you for submitting this feedback. After carefully evaluating all of the suggestion items in our pipeline, we are closing items that we will not implement in the near future due to current higher priority items. We will re-evaluate the closed suggestions again in the future based on the product roadmap.
Thanks again for providing the product suggestion and continued support for our product.
Posted by SAinCA on 8/23/2013 at 11:24 AM
Back in "the day" when the language didn't have Static/Constant support, we used to write an "Initialize" subroutine that every module would call to set things like maxima and minima. An SP with OUTPUT parameters will do exactly the same thing with one chunk of maintained source code and a template in SSMS / snippet in Red Gate's SQL Prompt, to add the invocation code to your SP. If it happens you need the values in a UDF, write a table-valued UDF to do set the same values but as columns and return a row, then set in your consuming UDF or use in SELECT.

Constants/Statics have been requested for years - intransigent responses from MS to date. Workarounds required :-)

Apologies if the above is "the bleep-bleep obvious"...
Posted by Tom Groszko on 7/18/2013 at 6:08 AM
When doing this it makes sense to me to do all numeric types and include both min and max, like the .NET libraries do.
Sign in to post a workaround.