Can some one help me with the syntax to change the datetime data type to the
following format:
mmm yy
Example: Feb 05
Thanks= Format(Fields!myDateField.Value,"dd MMM")
"anthonysjo" wrote:
> Can some one help me with the syntax to change the datetime data type to the
> following format:
> mmm yy
> Example: Feb 05
> Thanks|||Can this syntax only be used in SRS or can I use it when writing queries in
query analyzer or when building views?
"Andre" wrote:
> = Format(Fields!myDateField.Value,"dd MMM")
> "anthonysjo" wrote:
> > Can some one help me with the syntax to change the datetime data type to the
> > following format:
> > mmm yy
> > Example: Feb 05
> >
> > Thanks|||For SQL I usually use syntax like this, but the datatype is not datetime
anymore:
Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
OR
Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
datename(yy,myDate) from MyTable
Andre
"anthonysjo" wrote:
> Can this syntax only be used in SRS or can I use it when writing queries in
> query analyzer or when building views?
> "Andre" wrote:
> > = Format(Fields!myDateField.Value,"dd MMM")
> >
> > "anthonysjo" wrote:
> >
> > > Can some one help me with the syntax to change the datetime data type to the
> > > following format:
> > > mmm yy
> > > Example: Feb 05
> > >
> > > Thanks|||One last question...with mm the month comes back as January. Can I get it
to display just Jan?
"Andre" wrote:
> For SQL I usually use syntax like this, but the datatype is not datetime
> anymore:
> Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
> OR
> Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
> datename(yy,myDate) from MyTable
> Andre
>
> "anthonysjo" wrote:
> > Can this syntax only be used in SRS or can I use it when writing queries in
> > query analyzer or when building views?
> >
> > "Andre" wrote:
> >
> > > = Format(Fields!myDateField.Value,"dd MMM")
> > >
> > > "anthonysjo" wrote:
> > >
> > > > Can some one help me with the syntax to change the datetime data type to the
> > > > following format:
> > > > mmm yy
> > > > Example: Feb 05
> > > >
> > > > Thanks|||You might also try
select convert(char(6),getdate(),107)
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Andre" <Andre@.discussions.microsoft.com> wrote in message
news:2DBB1EA5-B231-49FB-A548-1CAE3E763B1E@.microsoft.com...
> For SQL I usually use syntax like this, but the datatype is not datetime
> anymore:
> Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
> OR
> Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
> datename(yy,myDate) from MyTable
> Andre
>
> "anthonysjo" wrote:
>> Can this syntax only be used in SRS or can I use it when writing queries
>> in
>> query analyzer or when building views?
>> "Andre" wrote:
>> > = Format(Fields!myDateField.Value,"dd MMM")
>> >
>> > "anthonysjo" wrote:
>> >
>> > > Can some one help me with the syntax to change the datetime data type
>> > > to the
>> > > following format:
>> > > mmm yy
>> > > Example: Feb 05
>> > >
>> > > Thanks|||Where do I define the field I want to use in this example?
select convert(char(6),getdate(),107)
"Wayne Snyder" wrote:
> You might also try
> select convert(char(6),getdate(),107)
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Andre" <Andre@.discussions.microsoft.com> wrote in message
> news:2DBB1EA5-B231-49FB-A548-1CAE3E763B1E@.microsoft.com...
> > For SQL I usually use syntax like this, but the datatype is not datetime
> > anymore:
> >
> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
> > OR
> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
> > datename(yy,myDate) from MyTable
> >
> > Andre
> >
> >
> > "anthonysjo" wrote:
> >
> >> Can this syntax only be used in SRS or can I use it when writing queries
> >> in
> >> query analyzer or when building views?
> >>
> >> "Andre" wrote:
> >>
> >> > = Format(Fields!myDateField.Value,"dd MMM")
> >> >
> >> > "anthonysjo" wrote:
> >> >
> >> > > Can some one help me with the syntax to change the datetime data type
> >> > > to the
> >> > > following format:
> >> > > mmm yy
> >> > > Example: Feb 05
> >> > >
> >> > > Thanks
>
>|||replace the getdate().
select convert(char(6),somefield,107) from sometable
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"anthonysjo" <anthonysjo@.discussions.microsoft.com> wrote in message
news:FD07C54C-0108-42EF-A32D-908BC5D1903E@.microsoft.com...
> Where do I define the field I want to use in this example?
> select convert(char(6),getdate(),107)
> "Wayne Snyder" wrote:
>> You might also try
>> select convert(char(6),getdate(),107)
>> --
>> Wayne Snyder MCDBA, SQL Server MVP
>> Mariner, Charlotte, NC
>> (Please respond only to the newsgroup.)
>> I support the Professional Association for SQL Server ( PASS) and it's
>> community of SQL Professionals.
>> "Andre" <Andre@.discussions.microsoft.com> wrote in message
>> news:2DBB1EA5-B231-49FB-A548-1CAE3E763B1E@.microsoft.com...
>> > For SQL I usually use syntax like this, but the datatype is not
>> > datetime
>> > anymore:
>> >
>> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
>> > OR
>> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
>> > datename(yy,myDate) from MyTable
>> >
>> > Andre
>> >
>> >
>> > "anthonysjo" wrote:
>> >
>> >> Can this syntax only be used in SRS or can I use it when writing
>> >> queries
>> >> in
>> >> query analyzer or when building views?
>> >>
>> >> "Andre" wrote:
>> >>
>> >> > = Format(Fields!myDateField.Value,"dd MMM")
>> >> >
>> >> > "anthonysjo" wrote:
>> >> >
>> >> > > Can some one help me with the syntax to change the datetime data
>> >> > > type
>> >> > > to the
>> >> > > following format:
>> >> > > mmm yy
>> >> > > Example: Feb 05
>> >> > >
>> >> > > Thanks
>>|||Ok that getst the Month format correct but the year is wrong now...I get
things like Jan 01, Jan 08, Jan 15, Jan 22, Jan 29, etc...which are the weeks
for which each period closes. How do I get it to come out as 3char month and
year Like Jan 05?
convert(char(6), [EP].[PRD_FINISH_DATE],107)AS [Month]
"Bruce L-C [MVP]" wrote:
> replace the getdate().
> select convert(char(6),somefield,107) from sometable
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "anthonysjo" <anthonysjo@.discussions.microsoft.com> wrote in message
> news:FD07C54C-0108-42EF-A32D-908BC5D1903E@.microsoft.com...
> > Where do I define the field I want to use in this example?
> > select convert(char(6),getdate(),107)
> >
> > "Wayne Snyder" wrote:
> >
> >> You might also try
> >>
> >> select convert(char(6),getdate(),107)
> >>
> >> --
> >> Wayne Snyder MCDBA, SQL Server MVP
> >> Mariner, Charlotte, NC
> >> (Please respond only to the newsgroup.)
> >>
> >> I support the Professional Association for SQL Server ( PASS) and it's
> >> community of SQL Professionals.
> >> "Andre" <Andre@.discussions.microsoft.com> wrote in message
> >> news:2DBB1EA5-B231-49FB-A548-1CAE3E763B1E@.microsoft.com...
> >> > For SQL I usually use syntax like this, but the datatype is not
> >> > datetime
> >> > anymore:
> >> >
> >> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
> >> > OR
> >> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
> >> > datename(yy,myDate) from MyTable
> >> >
> >> > Andre
> >> >
> >> >
> >> > "anthonysjo" wrote:
> >> >
> >> >> Can this syntax only be used in SRS or can I use it when writing
> >> >> queries
> >> >> in
> >> >> query analyzer or when building views?
> >> >>
> >> >> "Andre" wrote:
> >> >>
> >> >> > = Format(Fields!myDateField.Value,"dd MMM")
> >> >> >
> >> >> > "anthonysjo" wrote:
> >> >> >
> >> >> > > Can some one help me with the syntax to change the datetime data
> >> >> > > type
> >> >> > > to the
> >> >> > > following format:
> >> >> > > mmm yy
> >> >> > > Example: Feb 05
> >> >> > >
> >> >> > > Thanks
> >>
> >>
> >>
>
>|||Look in books online for SQL Server. It provides all your different options
for convert (there are a lot of options).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"anthonysjo" <anthonysjo@.discussions.microsoft.com> wrote in message
news:8C98B402-8A2F-4DCA-AE62-6985F5496FE6@.microsoft.com...
> Ok that getst the Month format correct but the year is wrong now...I get
> things like Jan 01, Jan 08, Jan 15, Jan 22, Jan 29, etc...which are the
> weeks
> for which each period closes. How do I get it to come out as 3char month
> and
> year Like Jan 05?
> convert(char(6), [EP].[PRD_FINISH_DATE],107)AS [Month]
> "Bruce L-C [MVP]" wrote:
>> replace the getdate().
>> select convert(char(6),somefield,107) from sometable
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "anthonysjo" <anthonysjo@.discussions.microsoft.com> wrote in message
>> news:FD07C54C-0108-42EF-A32D-908BC5D1903E@.microsoft.com...
>> > Where do I define the field I want to use in this example?
>> > select convert(char(6),getdate(),107)
>> >
>> > "Wayne Snyder" wrote:
>> >
>> >> You might also try
>> >>
>> >> select convert(char(6),getdate(),107)
>> >>
>> >> --
>> >> Wayne Snyder MCDBA, SQL Server MVP
>> >> Mariner, Charlotte, NC
>> >> (Please respond only to the newsgroup.)
>> >>
>> >> I support the Professional Association for SQL Server ( PASS) and it's
>> >> community of SQL Professionals.
>> >> "Andre" <Andre@.discussions.microsoft.com> wrote in message
>> >> news:2DBB1EA5-B231-49FB-A548-1CAE3E763B1E@.microsoft.com...
>> >> > For SQL I usually use syntax like this, but the datatype is not
>> >> > datetime
>> >> > anymore:
>> >> >
>> >> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) from MyTable
>> >> > OR
>> >> > Select datename(dd,myDate) + ' ' + datename(mm,myDate) + ' ' +
>> >> > datename(yy,myDate) from MyTable
>> >> >
>> >> > Andre
>> >> >
>> >> >
>> >> > "anthonysjo" wrote:
>> >> >
>> >> >> Can this syntax only be used in SRS or can I use it when writing
>> >> >> queries
>> >> >> in
>> >> >> query analyzer or when building views?
>> >> >>
>> >> >> "Andre" wrote:
>> >> >>
>> >> >> > = Format(Fields!myDateField.Value,"dd MMM")
>> >> >> >
>> >> >> > "anthonysjo" wrote:
>> >> >> >
>> >> >> > > Can some one help me with the syntax to change the datetime
>> >> >> > > data
>> >> >> > > type
>> >> >> > > to the
>> >> >> > > following format:
>> >> >> > > mmm yy
>> >> >> > > Example: Feb 05
>> >> >> > >
>> >> >> > > Thanks
>> >>
>> >>
>> >>
>>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment