Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » MSSQL The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1930 Views
  • lanks
    Avatar
    Community Member
    61 Posts

    MSSQL The conversion of a varchar data type to a datetime data type resulted in an out-of-range value Link to this post

    I have been running a website on MS SQL Server/Windows Server 2008 without any issues. Now all of a sudden it can't run any queries where it is updating date values.... I have tried executing these queries manually through the sql server management studio and they run fine.

    I tried to do a fresh install of Silverstripe and this is what I got when running the install:

    [User Error] Couldn't run query (22007, 242, [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.01000, 3621, [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.): UPDATE "SiteConfig" SET "ClassName" = 'SiteConfig', "Title" = 'Your Site Name', "Tagline" = 'your tagline here', "LastEdited" = '2012-01-13 07:29:48', "Created" = '2012-01-13 07:29:48' where "ID" = 1: [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.; [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.
    POST /install.php

    Line 620 in C:\inetpub\wwwroot\dlproperty\sapphire\core\model\Database.php
    Source

    611    /**
    612     * Error handler for database errors.
    613     * All database errors will call this function to report the error. It isn't a static function;
    614     * it will be called on the object itself and as such can be overridden in a subclass.
    615     * @todo hook this into a more well-structured error handling system.
    616     * @param string $msg The error message.
    617     * @param int $errorLevel The level of the error to throw.
    618     */
    619    function databaseError($msg, $errorLevel = E_USER_ERROR) {
    620       user_error($msg, $errorLevel);
    621    }
    622    
    623    /**
    624     * Enable supression of database messages.
    625     */
    626    function quiet() {

    Trace

    Couldn't run query (22007, 242, [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.01000, 3621, [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.): UPDATE "SiteConfig" SET "ClassName" = 'SiteConfig', "Title" = 'Your Site Name', "Tagline" = 'your tagline here', "LastEdited" = '2012-01-13 07:29:48', "Created" = '2012-01-13 07:29:48' where "ID" = 1: [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.; [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.
    Line 620 of Database.php
    SS_Database->databaseError(Couldn't run query (22007, 242, [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.01000, 3621, [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.): UPDATE "SiteConfig" SET "ClassName" = 'SiteConfig', "Title" = 'Your Site Name', "Tagline" = 'your tagline here', "LastEdited" = '2012-01-13 07:29:48', "Created" = '2012-01-13 07:29:48' where "ID" = 1: [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.; [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.,256)
    Line 209 of MSSQLDatabase.php
    MSSQLDatabase->databaseError(Couldn't run query (22007, 242, [Microsoft][SQL Server Native Client 10.0][SQL Server]The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.01000, 3621, [Microsoft][SQL Server Native Client 10.0][SQL Server]The statement has been terminated.): UPDATE "SiteConfig" SET "ClassName" = 'SiteConfig', "Title" = 'Your Site Name', "Tagline" = 'your tagline here', "LastEdited" = '2012-01-13 07:29:48', "Created" = '2012-01-13 07:29:48' where "ID" = 1,256)
    Line 310 of MSSQLDatabase.php
    MSSQLDatabase->query(UPDATE "SiteConfig" SET "ClassName" = 'SiteConfig', "Title" = 'Your Site Name', "Tagline" = 'your tagline here', "LastEdited" = '2012-01-13 07:29:48', "Created" = '2012-01-13 07:29:48' where "ID" = 1)
    Line 568 of Database.php
    SS_Database->manipulate(Array)
    Line 174 of DB.php
    DB::manipulate(Array)
    Line 1048 of DataObject.php
    DataObject->write()
    Line 206 of SiteConfig.php
    SiteConfig::make_site_config()
    Line 173 of SiteConfig.php
    SiteConfig->requireDefaultRecords()
    Line 235 of DatabaseAdmin.php
    DatabaseAdmin->doBuild(1)
    Line 1093 of install.php
    Installer->install(Array)
    Line 190 of install.php

    Any help is much appreciated.

    Liam

  • ronaan
    Avatar
    Community Member
    9 Posts

    Re: MSSQL The conversion of a varchar data type to a datetime data type resulted in an out-of-range value Link to this post

    I get the same error on a running installation that worked fine for oh, something like 10 days.
    No idea what I did wrong, seems I changed the date format and added a user or two.
    Now when I try to log into the admin panel I get that error.

    Any ideas how to fix this without destroying 10 days worth of content?

    Windows Server 2008 R2
    SQLExpress

    1930 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.