SQL Server Time fields and Powerbuilder
- New
- Issue
-
Richard Donagrandi
- PowerBuilder
- Monday, 14 July 2025 08:04 PM UTC
PB 2022 R3 build 3397
SQL Server 2022 and ODBC
Windows 11
My table in SQL Server has a time field. In Powerbuilder, open a new datawindow and add the time field. The graphical sql editor will show it's a time field, although in SQL Server it may show as time(6), it shows in Powerbuilder as time(0). Once the field is added, and you return to the datawindow layout, the column definition will be char(15). If you attempt to update this datawindow, you will get an incorrect cast error.
Workaround: Edit the source of the datawindow and change the datatype of the column definition to "time".
If you edit the SQL of this datawindow in the graphical editor, Powerbuilder changes the field back to char(15).
Secondary issue: once you make the edit-source change, the datawindow layout still won't know how to format the field. You must manually change the format to "[time]".
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.