Getting Started with Adobe After Effects - Part 6: Motion Blur
Ask
Ask questions, discuss or help others by answering
Related Posts · View All
SQL Server 141
TSQL 75
SSRS 70
SSIS 66
XML 54

Top Categories · View All
SQL Server 141
TSQL 75
SSRS 70
SSIS 66
XML 54

Confusing Sql SELETCT behaviour

Jun 20 2012 12:00AM by Anilvanjre   

hi, my question may be simple but i didn't understand the behavior of the SELECT statement.

Query : SELECT 1 Output : 1

Query : SELECT 'z' Output : z

Query : SELECT 1z Output : 1

why this happen , i think it is a sql server browser behavior , please explain any one

Submitted under: Microsoft SQL Server · TSQL ·  ·  · 


Anilvanjre
257 · 1% · 170

3 Replies

  • It is all about what should be done when an INCORRECT value is used in an expression. In this example, you are passing a value which is not a number, nor a string (strings should be placed within quotes). So SQL Server tries to be bit smart and consider it as a number and strips off the 'bad' part.

    Considering that a developer is not supposed to write a query as above, I would say that the behaviour seems correct to me.

    commented on Jun 25 2012 9:42PM
    Jacob Sebastian
    1 · 100% · 32002
  • Please see Mitesh's reply on this thread that is probably a better answer.

    commented on Jun 25 2012 9:44PM
    Jacob Sebastian
    1 · 100% · 32002
  • If you had looked at the column alias you would have found out yourself :)

    commented on Jun 26 2012 12:27AM
    Madhivanan
    3 · 39% · 12419

Your Reply


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]