pass through date results from sql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coby

    pass through date results from sql

    I am doing a pass through query from access and want sql to only return
    the date part of a datetime formatted column. I am attempting to query
    a table within a database on a third party server running sql 2005. My
    results are returned in datetime format, yet I only want the date part
    of the data and do not know the sql query language enough to know how
    to state it. Currently, by query is SELECT (CompletedDT) AS [Date].
    If it were VBA I would query it as Select
    Format$([CompletedDT],'mm/dd/yyyy') AS [Date]. Since pass through
    querys actually use the server where the data resides to perform the
    query I must use sql language. How does that VBA statement translate
    in sql, if it does at all? Thanks for any help.

  • Rick Brandt

    #2
    Re: pass through date results from sql

    Coby wrote:
    I am doing a pass through query from access and want sql to only
    return the date part of a datetime formatted column. I am attempting
    to query a table within a database on a third party server running
    sql 2005. My results are returned in datetime format, yet I only
    want the date part of the data and do not know the sql query language
    enough to know how to state it. Currently, by query is SELECT
    (CompletedDT) AS [Date]. If it were VBA I would query it as Select
    Format$([CompletedDT],'mm/dd/yyyy') AS [Date]. Since pass through
    querys actually use the server where the data resides to perform the
    query I must use sql language. How does that VBA statement translate
    in sql, if it does at all? Thanks for any help.
    You either get "only the date" or you get a DateTime type back. You cannot do
    both. If you are okay with Text (like Format gives you) then...

    Convert(VarChar (10), FieldName,101)

    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com



    Comment

    Working...