When doing a "connect to existing" installation, I get the dreaded "Must declare scalar vairable @found" error RRS feed

  • Question

  • As you are probably aware, there are 3 possible upgrade approaches from CRM 4.0 to 2011, In-Place (no go, in our case as CRM 2011 will not install on Windows Server 2003, where the source CRM 4.0 installation is), then Connect to Existing (during 2011 installation wizard), and lastly Migration (By running the deployment manager after installing with a new “dummy” organization)

    Attempting both of the latter approaches results in failure, but in specific, I would like to find out regarding the Connect to Existing, approach and associated error.

    So first off, I am doing a CRM 2011 installation on a new Windows Server 2008 R2 machine (Not a DC ) I will call that SERVER2011. The associated CRM database is to run on a SQL 2008 R2 instance on SERVER2011 too.

    SERVER2011 falls under a DC also running Windows Server 2008 R2 (I will call it DCW2008), which has a third machine on its domain… the existing Windows Server 2003 CRM 4.0 machine, which I will call SERVER2003.

    When I run the install wizard on SERVER2011, I get to the point where I chose the connect to existing option and select the XXX_MSCRM database on SERVER2003 server, and follow the wizard as usual and get this error message whilst the data is copying to the new database on SERVER2011.


    I have searched the net and found only 2 different possible reasons, all be it that the hits I visited are in the dozens.

    1. Variable declaration and assignment in one statement  http://www.sql-server-helper.com/error-messages/msg-139.aspx does not work on SQL versions earlier than SQL 2008, e.g.

    DECLARE @Radius      FLOAT = 12.5

    DECLARE @Diameter    FLOAT = PI() * 2 * @Radius

    Which should rather be as below, but for SQL Server 2008 this is not supposed to be an issue.

    DECLARE @Radius      FLOAT
    DECLARE @Diameter    FLOAT
    SET @Radius = 12.5
    SET @Diameter = PI() * 2 * @Radius


    Is it possible that whoever designed the Wizard has generated a script on the fly, using a declaration and assignment in one line, but the script is being run against the source master database, forgetting that the source could be an older version than SQL 2008? 

    One thing I did was look for all occurrences in all objects in a database for the @found variable, using a personal script I have accumulated in my own library, and I could find no occurrences in the XXX_MSCRM database or MSCRM_CONFIG database, HOWEVER the Master database yielded some system stored procedures using these variables.

    Now, as I say above, the installation wizard, could be using a script based on the assumption of a SQL  Server 2008 database, querying the source Master database, but I am connecting to a source database on a SQL Server 2005 machine, and like I say, the wizard could be using a 2008 friendly script (generated from wizard), to run against the master DB on the 2005 instance where such one line declaration and assignment is a problem.

    So what I did was instead of running the copy from the old SQL Server 2005 database (as the CRM installation wizard may be using the Master database on the unsupported SQL Server 2005 database). I backed up the XXX_MSCRM database ( and the configuration database of course), from the old and restored it to the new, renaming it XXX4_MSCRM, as in the CRM installation wizard I wish to keep the same name for the new database as the old, i.e. XXX_MSCRM.

    Then I did the install again, selecting the copy from existing option above, only copying from the ”existing” restore on SQL 2008. This still produced the same failure.

    2. Some reckon it is to do with reporting services, http://social.msdn.microsoft.com/Forums/sqlserver/en-US/7e287957-773f-4875-bad7-f3bad956d14f/installing-crm-2011-on-sql-2008?forum=sqlgetstarted

    But still no luck following their suggestions


    No viable solution is being found on the net.


    Any ideas, anyone, please?

    Saturday, January 11, 2014 11:44 AM