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

  • Home
  • SEARCH
  • 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 4251058
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:36:39+00:00 2026-05-21T04:36:39+00:00

I have an application which will manage releases of DDL changes and TSql Executable

  • 0

I have an application which will manage releases of DDL changes and TSql Executable statements to a SQL server database.

Basic workflow: Developer submits .sql file, file is collected, SQL reviewed and assigned a step in a release cycle, release is executed in the database using a stored procedure and it will cycle through the steps executing the SQL within a single SQL transaction using sp_EXECUTESQL. If any errors occur the transaction does not commit the DDL changes. This process manages SQL from a single database to multiple database on the same instance.

The problem I have is that when the SQL scripts are submitted they contain “GO” statements which sp_EXECUTESQL does not support and throws the “Incorrect syntax near ‘GO'” error. I can split and break up most transactions by parsing on the ‘GO’ keyword but this will not work for items that are in other databases. Once I have an ALTER of some sort against another database I need the ‘GO’. e.g. the following hase ot be executed together, cannot be split and executed as two statements:

USE [MyDatabaseOtherThanOneIAmExecutingFrom]
GO
Alter PROCEDURE [dbo].[DoSomething]
...

Syntactically the following statement won’t work so requesting the dev’s to change their sql to prefix with a db name would only cover non DDL SQL:

 Alter PROCEDURE [MyDatabaseOtherThanOneIAmExecutingFrom].[dbo].[DoSomething]

Original requirement was to stay within the database to perform these deployment actions so writing a short one off application to execute the batches from .Net using SqlCommand was not an option.

Is there another option to handle this within the database or do I need to extend outside and create an application to manage the SQL steps execution?

  • 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-21T04:36:40+00:00Added an answer on May 21, 2026 at 4:36 am

    You can nest sp_executesql calls. It’s a bit ugly, but it works, and allows you to execute DDL against other databases:

    sp_executesql N'use OtherDB exec sp_executesql N''create procedure DoStuff @Parm1 varchar(10) as select * from sysobjects'''
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application which will have a client and server components.
I'm thinking how to arrange a deployed python application which will have a Executable
I have a basic ajax application, which will not work, instead the php code
I have an idea for a simple application which will monitor a group of
I'm looking at building a Rails application which will have some pretty large tables
I have a web based application which server's content to authenticated users by interacting
I have an application which really should be installed, but does work fine when
I have an application which extracts data from an XML file using XPath. If
We have an application which needs to use Direct3D. Specifically, it needs at least
I have an application which behaves as a slideshow for all pictures in a

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.