The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Get date from SQL server, not local machine
Posted: 10 Jun 08 8:16 AM
|
I want to get the date from the SQL server or App server, not the local machine. When using 'Date' it returns the time for the local machine. How can I get the time from one of the servers? Thanks |
|
|
| |
| |
| |
|
Re: Get date from SQL server, not local machine
Posted: 11 Jun 08 11:35 AM
|
In general this practice should be avoided. In most cases the client's datetime is the appropriate value, not the server's. More importantly, this will cause data inconsistencies with remotes. If a transaction happens Jan 1st 8 AM on the server, the datetime field will read Jan 1st 8 AM (or the UTC adjusted value). The remote databases do not receive the transactions until a future time so their data will not read Jan 1st 8 AM.
Getting the server's datetime is the only business case I have encountered (and this thread is that encounter) that warrants bypassing the client side technologies at our disposal. I recommend as a best practice that client side datetime values be used: now in vbscript, DateTime.Now in C#, etc.
Timmus |
|
|
|
Re: Get date from SQL server, not local machine
Posted: 11 Jun 08 12:16 PM
|
Timmus,
Great point. We don't have remotes, so that's why I've not encounted any problems. I will have to remember this if/when we do implement remotes.
Thanks for the clarification.
...Rob |
|
|
|
Re: Get date from SQL server, not local machine
Posted: 11 Jun 08 12:28 PM
|
Rob, I am happy to help.
I dont mean to step onto a soapbox but I do sense a common sentiment when it comes to sync: we dont have remotes now so we dont have to worry about it. Businesses are constantly changing as we all know. You very well may be asked to implement remotes tomorrow so treat your systems as if you do have sync. Granted, there are times the non-sync friendly solution is significantly cheaper, easier, etc. For those cases, you have to make an informed decision. However, it would be prudent to opt for the sync friendly techniques more often than not.
BTW, Steve, what is the reason for the Server DateTime requirement? If you are using SalesLogix datetime fields it stores the datetime as UTC. This is the beauty of UTC: it doesn't matter what timezone the client is in since it is adjusted to UTC before being stored in the database. I wonder if we are trying to solve a non-issue.
Timmus |
|
|
|
Re: Get date from SQL server, not local machine
Posted: 11 Jun 08 12:37 PM
|
Timmus,
I completely agree with you. It's just that we have a custom workflow process that relies on createdates and I needed a centralized time. If/When we do decide to open up remotes, It will be a full project to ensure the functionality of our heavy customizations - We have developed a complete staffing/recruiting & HR module in Saleslogix, so going remote will be no easy task.
I appreciate your insight.
...Rob |
|
|
|
Re: Get date from SQL server, not local machine
Posted: 11 Jun 08 3:34 PM
|
Timmus:
I can give you one example. When you are integrating with an outside system and you are using a time based sync scenario you want to make sure the date time value posted in a field is coming from one central source. This would have not impact on syncing with remotes because that date value is not relevant for a remote user, it is an "internally" used date for a specifice workflow.
That being said, I have to put in my soap box moment to state that I hate integration solutions that use a date / time value because you always have the chance to have records fall between the cracks. But that is for another thread and another day's topic.
Ted |
|
|
| |
| |
|
Re: Get date from SQL server, not local machine
Posted: 22 Aug 08 10:29 AM
|
If you don't have remotes, then it should't matter which time you use. Since SLX saves datetime fields in GMT, any difference between server time and client time means that one of the clocks is off.
BTW, for records created/modified in remotes, do the create and modify dates in the production database reflect when they were created/modified in the remote, or when they were synced to the production server?
|
|
|
|