“The string ‘xxx’ was not recognized as a valid DateTime” when
converting DataWindow to data model
The following error occurs when generating the data model from the
DataWindow that uses the stored procedure as a data source.
|
1 |
Error: The string '"getdate"()' was not recognized as a valid DateTime. |
Cause:
The stored procedure calls a function to set the value of its
parameter; while PowerServer failed to identify the data type of the
function and failed to generate the model.
For example, the following stored procedure is unsupported, as it
calls the getdate() function to set the parameter value:
|
1 2 3 4 5 6 7 8 9 10 |
create procedure usp_testnextday @as_of_dt datetime = <span><strong>getdate()</strong></span> as begin DECLARE @next_dt datetime SELECT @next_dt = dateadd(day, 1, @as_of_dt ) SELECT next_dt = @next_dt End |
Solution:
You can work around this error by assigning a null value to the
parameter, and then call the function later to assign a different value
to the parameter. For example, you can rewrite the above stored
procedure as below:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
create procedure usp_testnextday @as_of_dt datetime = <span><strong>null</strong></span> as begin DECLARE @next_dt datetime <span><strong> If @as_of_dt is null SELECT @as_of_dt = getdate()</strong></span> SELECT @next_dt = dateadd(day, 1, @as_of_dt ) SELECT next_dt = @next_dt End |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest