Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Denver
    Posts
    2

    Unanswered: Dates and Differences between Query Analyzer and Enterprise Manager

    Hey Everyone,

    I am just starting to learn T-SQL and came across something that puzzled me when looking at dates.

    If I enter this:
    SELECT CONVERT(datetime, CONVERT(varchar, GETDATE(), 101)) AS Expr1

    In Enterprise Manager I get this output
    12/30/2002 - which is what I assumed that I should get

    In Query Analyzer I get this output
    2002-12-30 00:00:00.000 - which I did not expect

    Does anyone know why there would be a difference and if so, how do I get Query Analyzer to format as 12/31/2002?

    Thanks alot,
    Brent

  2. #2
    Join Date
    Dec 2002
    Location
    London, Ontario - Canada
    Posts
    3

    Re: Dates and Differences between Query Analyzer and Enterprise Manager

    Try only: SELECT CONVERT(varchar, GETDATE(), 101) AS Expr1

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    The style parameter is used when converting to a character type from a datetime - so when you converted it back to a datetime in query analyzer it showed you what you asked for. This is the true format - em will jack with the format but the reality is different. em will see all zeroes for time as no time and only displays slashes (no dashes).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •