DateTimeFormat database parameter
Description
When you update data in the DataWindow painter, PowerBuilder builds
a SQL UPDATE statement
in the background. The DateTimeFormat parameter determines how PowerBuilder specifies
a DateTime datatype when it builds the SQL UPDATE statement.
(A DateTime datatype contains both a date value and a time value.)
Controls
-
ADO.NET
-
OLE DB
-
SNC SQL Native Client for Microsoft SQL Server
Syntax
1 |
DateTimeFormat='<span>datetime_format</span> ' |
Parameter |
Description |
---|---|
datetime_format |
The datetime format you want PowerBuilder to For more on display formats, see the Users |
Default
If no value is specified for the DateTimeFormat parameter, PowerBuilder does not
use a datetime datatype.
Usage
When you call stored procedures, the database server might
not accept the DateTime format built by PowerBuilder. If this occurs,
you can try to use another format. For example, for Microsoft SQL
Server, try this format:
1 |
DateTimeFormat=''''yyyy-mm-dd hh:mm:ss.fff'''' |
PowerBuilder parses the backslash followed by two single quotes
(”’) as a single quote.
Examples
Assume you are updating a table named Files by setting
the Timestamp column to 4/2/06 3:45 pm. This DateTime
is represented by the following DateTime format:
1 |
m/d/yy h:mm am/pm |
To specify that PowerBuilder should use this format for the
DateTime datatype when it builds the SQL UPDATE statement:
-
Database
profileType the following in the DateTime Format box on the Syntax
page in the Database Profile Setup dialog box:1m/d/yy h:mm am/pm -
Application
Type the following in code:
1SQLCA.DbParameter="DateTimeFormat=''''m/d/yy h:mm am/pm''''"
What happens PowerBuilder builds
the following SQL UPDATE statement
to update the table:
1 |
UPDATE FILES |
1 |
SET TIMESTAMP='4/2/06 3:45 pm' |