|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Date Conversion to YYYYMMDDI have to convert a datetime column to YYYYMMDD format in an extract I'm
performing. I checked SQL Server Books Online and there does not seem to be a conversion style for YYYYMMDD. Can anyone help me with the SQL here? Is there any way to convert this date to YYYYMMDD format? Should I be using SUBSTRING instead??? Any help would be greatly appreciated. Thanks. wnfisba Use CONVERT function which has a style parameter
Show quote "wnfisba" <wnfi***@discussions.microsoft.com> wrote in message news:82553391-2A59-49EC-AEC2-522F4B3B9CFE@microsoft.com... >I have to convert a datetime column to YYYYMMDD format in an extract I'm > performing. > > I checked SQL Server Books Online and there does not seem to be a > conversion > style for YYYYMMDD. > > Can anyone help me with the SQL here? Is there any way to convert this > date > to YYYYMMDD format? Should I be using SUBSTRING instead??? > > Any help would be greatly appreciated. > > Thanks. > > wnfisba use convert with style 112 (ISO)
select convert(varchar(8),getdate(),112) Denis the SQL Menace http://sqlservercode.blogspot.com/ wnfisba wrote: Show quote > I have to convert a datetime column to YYYYMMDD format in an extract I'm > performing. > > I checked SQL Server Books Online and there does not seem to be a conversion > style for YYYYMMDD. > > Can anyone help me with the SQL here? Is there any way to convert this date > to YYYYMMDD format? Should I be using SUBSTRING instead??? > > Any help would be greatly appreciated. > > Thanks. > > wnfisba Won't this work?
select convert(varchar(8),getdate(),112) Show quote "wnfisba" wrote: > I have to convert a datetime column to YYYYMMDD format in an extract I'm > performing. > > I checked SQL Server Books Online and there does not seem to be a conversion > style for YYYYMMDD. > > Can anyone help me with the SQL here? Is there any way to convert this date > to YYYYMMDD format? Should I be using SUBSTRING instead??? > > Any help would be greatly appreciated. > > Thanks. > > wnfisba |
|||||||||||||||||||||||