ADO - Stored Procedure - Generated SQL
ADO - Stored Procedure - Generated SQL
Is there a way to intercept and view the generated SQL of a stored procedure call?
We have a strange date off by 2 issue.
#sql
Is there a way to intercept and view the generated SQL of a stored procedure call?
We have a strange date off by 2 issue.
#sql
If it's mssql Why don't you use the Sql profiler in Ssms
ReplyDeleteGood point, Peter Joseph - Also just rediscovered that we have no less than five methods of firing stored procs in our wrappers, all processing arguments in different ways.
ReplyDeleteDouble-check the parameters datatype: we had this problem when the parameter was interpreted as a double and not as a TDateTime. During the call, the date was converted to float, passed to the server as a float and re-converted to a sql datetime. This leads to the 2 day offset, since in delphi TDateTime(0) = '1899-12-30' and in mssql cast(0 as datetime) = '1900-01-01'
ReplyDeleteGiacomo Degli Esposti - That was indeed the problem. What fixed it was formatting the date as a string in the format that the db was set up for. The developer said "Don't tell anyone" as this was the method used numerous other places in the code :) The underlying cause appears to be that TDateTime turns to Double in a Variant array.
ReplyDeleteLars Fosdal LOL. Don't worry, this will stay a secret between you and me! ;-)
ReplyDelete