Specifying a date for MS SQL Server

 SQL  Comments Off on Specifying a date for MS SQL Server
Jul 272016
 

Today I had the “pleasure” to fix a problem in a customer’s SQL server database where some records had wrong values in date fields. The theory is quite simple. Find out which records are affected (there were only 7 of them) and correct the problem with a statement like this:

update tablename
set datefield='2008-02-14'
where someotherfield='somestringvalue'

Unfortunately the SQL server complained that it could not convert the string to a date. Google didn’t really help much because apparently it works like this for everybody else but me. But I found a hint how to test it quite simply:

select isdate('2008-02-14')

After a bit of try and error if found the problem:

The server did not actually assume a date of the form yyyy-mm-dd to be ISO 8601 as every human probably would. It assumed it to be yyyy-dd-mm so

select isdate('2008-14-02')

worked.

Americans! With yy/dd/mm You have given the world the most stupid date format ever, but Microsoft managed to top even that with yyyy-dd-mm.

So, eventually I used

update tablename
set datefield='2008-14-02'
where someotherfield='somestringvalue'

and it worked.

EDIT:

As Stefan Glienke pointet out in this Google+ post the order of y,m,d in a date is configurable with SET DATEFORMAT

So apparently on the machine I was working on it was set to

SET DATEFORMAT ydm

and I could have fixed the problem with

SET DATEFORMAT ymd

 Posted by on 2016-07-27 at 17:07

GExperts 1.38 experimental twm 2016-07-24 released

 Delphi, GExperts  Comments Off on GExperts 1.38 experimental twm 2016-07-24 released
Jul 262016
 

This is another test release before Erik is going to do an official 1.39 release. Please report any bugs you may find (preferentially in the GExperts community on Google+ or the bug tracker on SourceForge)

Again, I have built installers for each Delphi version. These installers should install everything that is necessary, including the files for the Code Formatter.

Apart from several bugfixes I have heavily added to the improvements for the search path dialog.

Head over to the Experimental GExperts page to download it.

 Posted by on 2016-07-26 at 21:14

Default color of a hint window

 Delphi  Comments Off on Default color of a hint window
Jul 262016
 

Since it doesn’t seem to be documented anywhere and at least in Delphi 2007 there is no constant for it:

The default background color of a hint window is

const
  clHintColor = $80FFFF;

(Taken from THintWindow.Create)

 Posted by on 2016-07-26 at 15:16

Updated GExperts Documentation

 Delphi, GExperts  Comments Off on Updated GExperts Documentation
Jul 232016
 

I added some new pages to my blog to document all the changes and improvements I have made to GExperts that so far are not in the official documentation.

GEXperts-SearchPathEnhancements2

I probably still missed a few…

 Posted by on 2016-07-23 at 22:40

Opening an explorer window from the folder select dialog

 Windows  Comments Off on Opening an explorer window from the folder select dialog
Jul 122016
 

Ever used a program that showed one of the folder select dialogs and you wanted to open a normal explorer window showing that folder? There is no button for that and no entry in the popup menu, but you can add one:

Create a new shortcut in

C:\Users\≶yourname>\AppData\Roaming\Microsoft\Windows\SendTo

Enter “Explorer” as the location and name of the shortcut.

Done.

Now you have an “Explorer” entry the Send To submenu of all popup menus which in the case of a folder opens a new explorer instance for this folder.

SendToExplorer

 Posted by on 2016-07-12 at 11:47