Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to store time (not date) in SQL and query from VFP
Message
 
 
À
03/03/2009 15:53:16
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01297626
Message ID:
01408526
Vues:
74
>>>I don't know off the top of my head. I pull it as a datetime by checking the time portion. For example, if the datetime field in sqlserver is 1901-01-01 15:15:00 and I want everything at or before 16:00 I would store "16:00:00" in lcTime and add this to my query:
>>>
>>>
AND schrun < = '1901-01-01 "+lcTime+"' "
>>>
>>>It comes back as a datetime field but that is fine for my purposes. I don't retrieve it as a character format. When the schrun field is stored, I force it to minutes and no seconds everytime from the app.
>>
>>I see, never mind then. I wanted to help someone by easier way. I'll play at night myself.
>
>Look up convert: select convert(char(8), schrun, 108) as mytime from msgschdl
>
>works for me (the datetime column is schrun and the table is msgschdl)

You (and others) may find this link useful.

http://www.sqlusa.com/bestpractices2005/centurydateformat/
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform