-
Jeff Martin
- PowerServer
- Wednesday, 18 November 2026 05:19 PM UTC
Environment:
- PowerBuilder 2025 R2, runtime 25.1.0.6430
- PowerServer 2025 R2 (package 3.1.0), Web API on .NET 10, hosted in IIS
- SQL Server 2022 (RTM) 16.0.1000.6
- Transaction uses DBMS MSOLEDBSQL
We are migrating an existing client/server app to PowerServer. Some DataWindows add a string to a date retrieval argument, for example:
WHERE appt_date <= :ld_end_date + ' 23:59:59'
In client/server this works, because the argument reaches SQL Server as datetime, and datetime + varchar is allowed. Under PowerServer the same DataWindow fails with:
The data types datetime2 and varchar are incompatible in the add operator.
So PowerServer appears to send date/datetime retrieval arguments as datetime2. We fixed the 4 DataWindows we found by rewriting the SQL as:
DATEADD(second, 86399, CAST(:ld_end_date AS datetime))
But the app has thousands of DataWindows and embedded SQL statements, and we'd like to know the full picture before scanning for every case.
Questions:
1. Is it by design that PowerServer sends date and datetime arguments as datetime2 to SQL Server?
2. Is there a setting (in the PowerServer project, AppConfig, the database connection settings or the connection string) that makes PowerServer send them as datetime instead?
3. Does the same apply to embedded SQL host variables and to stored procedure arguments, or only to DataWindow retrieval arguments?
4. Are there other known differences from client/server for date/time values that we should test for, such as precision or rounding when comparing against datetime columns?
Note: under PowerServer we also tried DisableBind=1 in the DbParm, but it caused error 241, because datetimes were then sent as text with 6 decimal places.
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.