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

When attempting to run IE on Windows Server 2008 under different user accounts using
I am attempting to run a Python application within Apache (prefork) with WSGI in
I'm attempting to run this Oracle query... SELECT COUNT(*) as total, q1 FROM exit_responses
I am attempting to run a threaded socket server that handles multiple clients simultaneously.
I am attempting to run a simple SQL stored procedure query, but am getting
I'm attempting to run some unit tests on my application using SQLite in memory,
I am attempting to run the sample project for N2CMS. This is required in
Say you have a large PHP project and suddenly, when attempting to run it,
I'm attempting to eliminate leading any leading zeroes in my date when I run
Attempting to deploy a MOSS solution to a UAT server from dev server for

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.