From: Tyro on
This isn't exactly a Microsoft Access question, but I didn't know where else
to go. I am using Microsoft SQL Server Management Studio. The table and
field name are “dbo.EncounterData.CreateDateTime” The results are formatted
like “2010-03-02 10:36:52.527”. Would you know how I can use the Convert
function to format the results as “yyyymmdd”. I know it is something like
one of these:

select (convert (char(8), getdate(), 112)

SELECT CONVERT(VARCHAR(8),CONVERT(DATETIME),112)

but I can't get either one to work.

--
Tyro from Missouri
From: Bob Barrows on
Tyro wrote:
> This isn't exactly a Microsoft Access question, but I didn't know
> where else to go. I am using Microsoft SQL Server Management Studio.
> The table and field name are "dbo.EncounterData.CreateDateTime" The
> results are formatted like "2010-03-02 10:36:52.527". Would you
> know how I can use the Convert function to format the results as
> "yyyymmdd". I know it is something like one of these:
>
> select (convert (char(8), getdate(), 112)

Why did you put the parenthesis before the name of the function? The general
syntax for calling functions is
functionname(parameters)
Like this:
select convert(char(8), getdate(), 112)

>
> SELECT CONVERT(VARCHAR(8),CONVERT(DATETIME),112)

Ughh! ;-)

The sql server version of this group is
microsoft.public.sqlserver.programming

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


From: Tyro on
Thank you Bob.
--
Tyro from Missouri


"Bob Barrows" wrote:

> Tyro wrote:
> > This isn't exactly a Microsoft Access question, but I didn't know
> > where else to go. I am using Microsoft SQL Server Management Studio.
> > The table and field name are "dbo.EncounterData.CreateDateTime" The
> > results are formatted like "2010-03-02 10:36:52.527". Would you
> > know how I can use the Convert function to format the results as
> > "yyyymmdd". I know it is something like one of these:
> >
> > select (convert (char(8), getdate(), 112)
>
> Why did you put the parenthesis before the name of the function? The general
> syntax for calling functions is
> functionname(parameters)
> Like this:
> select convert(char(8), getdate(), 112)
>
> >
> > SELECT CONVERT(VARCHAR(8),CONVERT(DATETIME),112)
>
> Ughh! ;-)
>
> The sql server version of this group is
> microsoft.public.sqlserver.programming
>
> --
> Microsoft MVP - ASP/ASP.NET - 2004-2007
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
> .
>