Date format using xp_cmdshell

  • Hi

    I have a server running SQL 7 on NT4 and recently installed SP4. I now have a strange date format problem. I'm returning a directory listing using the following command:

    master..xp_cmdshell 'dir'

    and it returns different results depending on whether the server is logged in or not. If the server is logged in then the dates are correctly returned in UK format dd/mm/yy However if the server is left not logged in at the CTRL+ALT+DEL prompt then the dates are returned in US format mm/dd/yy

    I'm not looking for a workaround, more an explanation of this behaviour. Are there any specific registry settings that control date formats before and after the login prompt?

    I also installed SP4 on another server with the same setup and didn't get this problem which confuses things further.!

     

    cheers

  • This was removed by the editor as SPAM

  • That is strange. Most likely the regional settings aren't applied until someone is logged in. Can you log in as the SQL Server service account and set the settings for UK that way? Or check them?

  • If you are running sql under the system account maybe the cause.

    In Control Panel, Regional Settings, set the locale and date/time settings and tick the box called Set as system default locale, apply the settings (requires a reboot).

    This should work. Be aware that this may affect anything you run on the server that uses date/time.

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply