What could be the cause why GETDATE()
is yielding different result when executed on Query Editor in SSMS (SQL Server Management Studio) versus from the one executed through Microsoft.Practices.EnterpriseLibrary.Data
by Database.ExecuteNonQuery()
function?
This GETDATE() is inside a Stored Procedure that UPDATE the date in a table.
Debug by us developers on SSMS:
EXEC [dbo].[SP_NameOfTheSPWithGetDate]()
= 11/4/2016 7:43 PM
Being run through the ASP.net webpage by end-user:
Database SampleDB;
SampleDB.ExecuteNonQuery('[dbo].[SP_NameOfTheSPWithGetDate]');
= 11/4/2016 11:43 AM
I suspect the difference might be because of the +8 offset of the GMT (our server is in GMT+8) they run the same exact SP but why the different result from GETDATE()?
We tried all sorts of functions to get the current date like:
GETUTCDATE()
CURRENT_TIMESTAMP
GETDATE()
GETSYSTEMDATE()
But still we have the same result.
This problem is weird since I don't really pass any value to the SP that may ever affect the GETDATE() function.
If you need additional info, feel free to ask to help solve this problem.
Additional Information (Update) :
- The one hosting the ASP.Net page server is different from the SQL Server Database.