Thursday, January 11, 2018

Running stored procedures from Dexterity vs. SSMS - an oddity

I was developing a customization for Dynamics GP using Dexterity.  The module I was writing in Dex called a stored procedure to load some data into a Dex table.

During testing no data was loading to the table so I started trouble-shooting to find the problem.

Most odd was the stored procedure returned data when I ran it from SQL.  However when it was run from Dexterity no results were returned.  A later iteration resulted in different counts between a SQL run or a Dex run.

I played with it enough to find the source of the problem:  One of my restrictions in test was to limit results using a hard-coded date value in the T-SQL WHERE clause.  When this date was set to 11/30/17 in the T-SQL WHERE I got no data returned in Dex.  When I changed this date to 11/1/17 I got all results returned, as if there were no date at all.  Again when run from SSMS the stored procedure produced expected results.

When I changed the year to 2017, i.e. using 11/1/2017, I got the same result from Dex as SQL.

Why does a stored procedure change behavior when it's being called from Dexterity versus when it's run from Management Studio?

WTF!!!

No comments:

Post a Comment