Transact-SQL Guru - How SQL Server Determines Type of the Constant

It's time for our next June TechNet Guru winner!

 

Multi MCC award winner, two-time TechNet Guru Gold Medal winner, and Wiki Ninja Green Belt, Naomi N is our SSRS TechNet Guru for June! See the TechNet Guru Contributions for June 2013.

Naomi N's avatar

ABOUT NAOMI: I am an IT professional with more than 15 years of experience in variety of programming languages and technologies. I am a Microsoft Community Award Recipient and Personality of the Year at UniversalThread.com forum in 2008,2009,2010,2011.  

 

Here is Naomi's winning article:

How SQL Server Determines Type of the Constant

 

Here are all the June T-SQL winners (two were from Naomi):

Guru Award  Transact-SQL Technical Guru - June 2013  

Gold Award Winner

 

Naomi N How SQL Server Determines Type of the Constant Richard Mueller: "A good recommendation to explicitly CAST values, with an example of possible consequences if you don't."

Silver Award Winner

 

Naomi N SET ANSI_PADDING Setting and Its Importance Samuel Lester: "Outstanding contribution! I love the process of walking us through the debugging you performed. People who read this article gain an understanding of not only the SET ANSI_PADDING setting, but also how you arrived at discovering this as well as the technical resources available to ask in the MSDN forums. Very, very good!" Ed Price: "Very in depth article with great code formatting!" Richard Mueller: "This explains an issue I was not aware of. Well researched. Good to include a script to correct the situation."

Bronze Award Winner

 

Johnny Bell Jnr SQL Server Result Set In An HTML Email Richard Mueller: "Very instructive. I like this because similar techniques can be used for other applications." Samuel Lester: "Great article and very handy for sure. I'm a big fan of code generation through T-SQL as you're doing with the @HTML parameter. I use similar tricks often to generate code for other programming languages. Very good!" Ed Price: "The text does a great job setting up the code blocks!"

Transact SQL was our second largest category with 9 submissions (4 from Naomi)! Naomi holds onto her title for a second month. Thanks go out to all our contributors... Kalman, Naomi, Sathyanarrayanan, and Johnny Bell! You made it tough on the judges to select from an excellent group! Please go check them all out here.

 

Here's an excerpt from the article:

 

Problem Definition

There was an interesting question asked recently in Transact-SQL forum "Basic doubt in Round function"

The problem was stated as following:

SELECTROUND(744, -3)

produced 1000 while

SELECTROUND(744.0, -3)

gave an error "Arithmetic overflow error converting expression to data type numeric."

 

==================

 

Read the rest here:

How SQL Server Determines Type of the Constant

 

Thanks to Naomi N for your great contribution to the TechNet Guru contest! You can read about all the June winners here: TechNet Guru Award Winners - June 2013

 

Also, for the July Guru competition, see TechNet Guru Contributions for July 2013.

 

Any questions or comments for Naomi?

 

Are you a Wiki Ninja? https://technet.com/wiki

 

    - User Ed