![]() |
Datenbank: MS-SQLServer • Version: 2005 • Zugriff über: egal
MS SQL Integer 'JJJJMMTT' in date casten
Hi,
ich habe in einer Fremd - DB ein Datum als Integer ((Format 'JJJJMMTT') also z.B. 20040507). Wie kann ich mit reinem SQL ein Datum daraus machen? Ich muss nur aus der DB importieren und wollte mir die Umwandlung in meinem Code sparen. Danke, Frank |
Re: MS SQL Integer 'JJJJMMTT' in date casten
Moin,
probier mal
SQL-Code:
convert(smalldatetime,'20101024')
|
Re: MS SQL Integer 'JJJJMMTT' in date casten
Hallo,
probier es mal mit
SQL-Code:
im SQL wäre das dann in der Form
select Cast('20040507' as DateTime)
SQL-Code:
select cast(Datumsspalte as DateTime) As Datum from tabelle
|
Re: MS SQL Integer 'JJJJMMTT' in date casten
Hi,
Danke für die Unterstützung. Sowohl convert als auch cast funktionieren, wenn ich den Integer noch in ein char(8) caste. Frank [Edit]Smilies deaktiviert[/EDIT] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:54 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz