Weblog @ rebex.cz

Weblogy na webu Rebexu
Welcome to Weblog @ rebex.cz Sign in | Help
in Search

Weblog @ Rebex.cz :: Honza Šotola

nepravidelné poznámky .NET vývojáře

SQL Server datetime formát – má víra byla scestná

Dlouhá léta jsem věřil, že pro textový zápis data (nebo data a času) je nejjistější používat ANSI SQL formát:
‘yyyy-mm-dd’ (nebo ‘yyyy-mm-dd hh:mi:ss’).
Není tomu tak – tento formát je poplatný jazykovému nastavení aktuální SQL connection.

Příklad:

image

Žil jsem tedy přes 10 let v bludu. Kajícně jsem si v článku v Books Online dohledal, že jazykově nezávislé formáty data v SQL Serveru jsou například:

  • yyyymmdd’ nebo ‘yyyymmdd hh:mi:ss
    ISO 8601 un-separated
  • ‘yyyy-mm-ddThh:mi:ss’
    ISO 8601 datetime
    (podle Books Online není jazykově nezávislý, ale podle mých pokusů i jiných zdrojů je nezávislý)
  • {d’yyyymmdd’} nebo {ts’yyyymmdd' hh:mi:ss’}
    ODBC formáty

POZN: Nové datové typy SQL Serveru 2008 jsou více jazykově neutrální – pro datový typ Date, DateTime2 nebo DateTimeOffset je jazykově neutrální i můj původně profanovaný formát ‘yyyy-mm-dd’ (nebo ‘yyyy-mm-dd hh:mi:ss’).

Příklady:

image

Další informace jsou moc hezky sepsané a shrnuté v následujícím článku:
http://www.karaszi.com/SQLServer/info_datetime.asp (zejména v kapitole “Date and time formats for input”).

Published 23. května 2011 13:28 by honzas
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Rehkop said:

Go tto the market, seearch for Sipp - Droid, and download and install

it. However it can generate additional site stats like screen resolution or visitor identifiers from tthe same log

files if you incluxe a small java script into your pages. Finally,

both of these phones are noted for their speed and lack of

lag when utilzing apps and navigating within their respective interfaces.

+

června 19, 2014 13:23
 

Duppstadt said:

This site was... how do I say it? Relevant!! Finally I have found something that helped me.

Appreciate it!

června 28, 2014 6:57
 

Trouton said:

Their customer service goes above and beyond in

order to help you get your money. He uses every drawn line to his advantage and breathes life into the words pouring forth from Snyder, Tynion IV, and company.

There are buyers out there that have to have swiftly entry to

richesse but they can't get any richesse just as a result of there are so handful of choices readily available.

července 4, 2014 2:41
 

Pendley said:

I'm not sure why buut this web site is loading extremely slow for me.

Is anyone else having this problem or is it a issue on my end?

I'll check back later and see iif the problem still exists.

září 6, 2014 10:59
 

Stefan said:

Ahoj Viem, že je to mimo tému, ale ja som sa opýtať, či ste

vedel o všetkých widgetov som mohol pridať na môj blog,

ktorý automaticky Tweet My najnovšie twitter aktualizácie.

Hľadal som naa plug-in takhle nejakú dobu, a dúfal, že možno budete

mať nejaké skúsenosti s niečím, ako je toto.

Prosím, dajte mi vedieť, ak sa dostanete do ničoho.

Naozj som si čítať váš blog a teším sa na vaše nové aktualizácie.

října 22, 2014 0:56
 

Bennett said:

bookmarked, fantastic website!

února 2, 2015 9:31
 

Owen said:

This excellent website truly has all the information and facts I needed

concerning this subject and didn't know who to ask.

května 1, 2015 5:16
 

market research naics said:

I loved as much as you'll receive carried out right

here. The sketch is tasteful, your authored subject matter stylish.

nonetheless, you command get bought an shakiness over that you wish

be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.

listopadu 1, 2016 3:27
 

Hot Sxeseis said:

It's neaqrly impossible tto find educated people in this particular topic, however,

you seem like you know what you're talking about!

Thanks

března 27, 2017 16:29
 

lottery ks said:

The odds of matching 4 of 5 winning numbers are 1 in 2,432 and the odds of matching 3 of 5

winning numbers are 1 in 81. Make plans to reach your financial mountain top and get out of the valley of want

and need. Article Source:  Davis is a Expert on Online Lotteries and a marketing executive at Triumph Marketing, you can find more of Jeff's lottery articles and buy real lottery tickets at.

Many individuals through the net state to possess

particular tried and examined approaches to help you you select profitable amounts but beware of them as most of those could possibly just be scams.

dubna 21, 2017 0:48

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems