Kbase P21642: How to write to a date time stamp field in the SQL server database
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  07/09/2004 |
|
Status: Unverified
GOAL:
how to write to a date time stamp field in the SQL server database
GOAL:
how to change a field of type date-time-stamp in the SQL server database
FIX:
/* if date_updated will be DATE in dataserver schema than */
/* just assign date_updated = today */
/* but will not be able to handle the time stamp in SQL server */
/* If date_updated is CHARACTER in dataserver schema */
/* then build a character representing the date and time */
/* with the same format as datetime in SQL SERVER */
DEF VAR vi AS INT.
DEF VAR dt AS DATE.
DEF VAR cdt AS CHAR.
dt = TODAY.
ASSIGN
cdt =
STRING( YEAR( dt ), '9999' )
+ '-' + STRING( MONTH( dt ), '99' )
+ '-' + STRING( DAY( dt ), '99' )
+ ' ' + STRING( TIME, "HH:MM:SS" )
+ '.' + STRING( ETIME MODULO 1000, '999' )
.
FIND FIRST customer .
ASSIGN customer.DATE_updated = cdt.
MESSAGE DATE_updated SKIP
cdt
VIEW-AS ALERT-BOX.