Difference between SELECT and PRINT statements

  • I ran the below two simple SQL queries in management studio

    SELECT getdate() -- returned 2008-06-26 23:11:44.030

    PRINT getdate() --returned Jun 26 2008 11:12PM

    now I wanted to know why there is a difference in the format returned by SELECT and PRINT statements



  • PRINT always returns a char/varchar, so when you make "PRINT GETDATE()" an implicit conversion is made.

    SELECT returns the datatype supplied.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply