Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4119870
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:08:48+00:00 2026-05-20T23:08:48+00:00

I am attempting to run the Elmah Sql Server DDL upon database generation in

  • 0

I am attempting to run the Elmah Sql Server DDL upon database generation in my EF4.1 CodeFirst application.

To accomplish this, in my DbInitializer.Seed Method I have:

    protected override void Seed(MyJobLeadsDbContext context)
    {
        // Run Elmah scripts
        context.Database.ExecuteSqlCommand(GetElmahDDLSql);
    }

GetElmahDDLSql is just a string constant that contains the entirety of the DDL from http://code.google.com/p/elmah/source/browse/trunk/src/Elmah/SQLServer.sql

Unfortunately, when this is run I get the following exception:

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'ALTER'.
Incorrect syntax near the keyword 'ALTER'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@ErrorId".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@TotalCount".
Must declare the scalar variable "@PageIndex".
Must declare the scalar variable "@TotalCount".
Must declare the scalar variable "@Application".
Must declare the scalar variable "@PageSize".
Must declare the scalar variable "@PageSize".
Must declare the scalar variable "@Application".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@ErrorId".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.

Any idea how to correctly execute the DDL via EF4.1?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:08:48+00:00Added an answer on May 20, 2026 at 11:08 pm

    As I know, you can’t use GO. GO is not SQL command it is special batch control command for tools like SQLCMD, OSQL or Query editor in SSMS. When using ADO.NET or EF you must divide your SQL script to commands and execut each part separately = each part between two GOs is separate command which needs its own ExecuteSqlCommand. There can be some issues with global variables in the script.

    Another approach is using SQL Server Management Objects to execute whole script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to design an achievement system in Ruby on Rails and have run
I'm attempting to write a performance testing function that can take any function, run
I am attempting to be a good TDD citizen as I design an application.
I am attempting to create a php script that can connect thru ssh to
I'm attempting to create an ASP.NET/C# page that runs a PowerShell script that will
When executing iis7psprov_x64.msi I immedialy receive a message saying: The PowerShell snap-in is part
I am building a universal app that uses a UISplitViewController for the iPad, and
Processes launched via Process.Start seems to have around a 26-second delay when the spawned
Possible Duplicate: create smart device cab through msbuild I know MSBUild struggles to build
I'm trying to make a HTTP request through an open SOCKS5 proxy. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.