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 6669857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:12:01+00:00 2026-05-26T03:12:01+00:00

Visual Studio has a Database Project for Sql Server. This has a number of

  • 0

Visual Studio has a Database Project for Sql Server. This has a number of advantages: it hosts configuration settings, and database objects in one place. The .sql files are part of the regular .NET solutions – visible in the Solution Explorer and editable in Visual Studio. And they have a mechanism for generating a deployment script. With each individual database object in it’s own file, the tracking of changes and source control is greatly simplified.

Has anyone had any success with using Database Projects with “non-SQL Server” databases? We use Sybase – which uses T-SQL and is very similar to SQL Server so I’m hopeful.

Or is there an alternative approach? I guess I could use a standard project (.csproj) and call a custom commandline application as part of the post-build to convert the .sql files into a deployment script.

Any ideas would be welcome.

Thanks

  • 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-26T03:12:01+00:00Added an answer on May 26, 2026 at 3:12 am

    OK, I’ll answer my own question.

    I added all of our SQL objects to their own .sql files within a Visual Studio .dbproj project. However, minor syntactic incompatibilities between the Sybase version of RAISERROR and the Microsoft version of RAISERROR caused the validation code built into Visual Studio to get unhappy. The problem with the database project was that this actually caused a compilation error – which basically made it into a show-stopper.

    So I scrapped that idea and added the .sql files to a standard .csproj project file. I then implemented some custom code that would load all of the .sql files, and aggregate them into a deployment script when invoked. I added a call to the custom code to the post build of the .csproj file so that whenever it was compiled – it would output a deployment script – which works like a dream with our build server.

    In order to get some of the benefits of the .dbproj, I looked into writing a full SQL parser, but was quickly discouraged by some of the posts on SO. Instead I did some rudimmentary parsing with regex – which got me a few cool features without a lot of effort:

    1. The code could detect dependencies between the various .sql files, and add them to the deployment script in the correct order to avoid sysdepends warnings.
    2. Where there were no dependencies, objects were ordered based on the object type (stored procedure, function, grant statement, etc) and then by name so that the resulting script was always ordered the same – which is very important if you need to diff two versions of the script.
    3. The deployment script can figure out some of the required permissions, so I don’t need to keep track of all of the GRANT statements.
    4. Stored procedures that are in the database but not in the script can be dropped automatically – so I don’t need to keep track of what state each database is in – we just run the script and everything is in the correct state.
    5. We have a few stored procedures that our automated tests call that shouldn’t be deployed. The code can detect these and include them in a Debug build and exclude them in a Release build.
    6. The custom code also generates a diff script that determines what changes the deployment script will make to a database and prints them out. This allows the person who is running the script to get an idea of what it will do. For example, the diff script might tell them that no changes will be made – so they don’t need to run the deployment script at all – which is kind of handy if it saves them logging in at 3am to take a database offline and take backups etc.

    So the end result is that all of my SQL objects are in separate files making them easy to work with in Visual Studio and manage under source control. For the first time since I started this job, I can look at the history in source control and tell what files have been changed (before this we had one enormous .sql file with absolutely everything in it).

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

Sidebar

Related Questions

In Visual Studio 2008, I have this database project to manage my SQL Server
I have a Visual Studio 2010 database project for my SQL Server 2005 database.
I have made an application project in Visual Studio 2008 C#, SQL Server from
In Visual Studio 2010, I have a Database Project. I can use this without
I have database project in visual studio 2010. It has tables views stored procedures
In Visual Studio, say you've got a SQL 2008 Database Project and you add
I am using a SQL 2008 database project (in visual studio) to manage the
Visual Studio has a way to import, export your color settings. Does Eclipse have
Project being built on ASP.net v 2 VB.net IIS 6 SQL Server 2005 database
I am using Visual Studio 2008 Database Project GDR2 to manage multiple databases and

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.