You are here: Re: Convert CHAR YYYYMMDD to mm/dd/yyyy « MsSQL Server « IT news, forums, messages
Re: Convert CHAR YYYYMMDD to mm/dd/yyyy

Posted by rdraider on 08/23/07 22:57

Thanks David.

I know how to generate CREATE TABLE scripts but is there a fast way to
generate INSERT statements for the actual data?



"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:PZudnSBdYIxykVPbnZ2dnUVZ8qGdnZ2d@giganews.com...
> "rdraider" <rdraider@sbcglobal.net> wrote in message
> news:5_nzi.11029$3x.7225@newssvr25.news.prodigy.net...
>> Correction the source field in an INT type
>> So how to convert INT type YYYYMMDD to a date mm/dd/yyyy
>>
>>
>
>
> DECLARE @dt INT;
> SET @dt = 20070823;
>
> SELECT CAST(CAST(@dt AS CHAR(8)) AS DATETIME) AS dt;
>
> --
> David Portas, SQL Server MVP
>
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
>
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация