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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:45:44+00:00 2026-05-25T15:45:44+00:00

To update an existing database we include a updates sql file which the installer

  • 0

To update an existing database we include a updates sql file which the installer runs. It looks to see if a table exists and if not then it creates it and the fields. This is an auto generated file from some nHibernate functionality.

IF NOT EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[TableA]') 
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
create table

This works fine for creating a new database but during development when the contents of the tables are changing this means the testing dept have to drop their database and start again from scratch. This is very time consuming for them as they then have to populate the tables with new data again. I have a pretty limited knowledge of sql and my searches for a solution have so far proven fruitless.

Is there a way to have the tables update regardless of whether they exist and not have to drop the schema and start again?

Many 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-25T15:45:46+00:00Added an answer on May 25, 2026 at 3:45 pm

    What you’re looking for is the ALTER TABLE, ADD statement.

    http://msdn.microsoft.com/en-us/library/ms190273.aspx

    ALTER TABLE Comments ADD newColumn INT 
    

    As an example.

    The question, then, becomes how do you do this for a whole database?
    What you will need is to have a SQL Delta tool. (Here’s an example of one http://www.sqldelta.com/ but there are others!)

    This tool will then generate an update script that you can run on your old database to bring it up to sync with your latest database.

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

Sidebar

Related Questions

I see that EF can update a model based on an existing database schema.
UPDATE: Setting foreign_key_checks to 1 does not trigger a scan of the existing table
I am in a situation where I must update an existing database structure from
I am not a .Net guy but trying to get update an existing .net
Purpose: I plan to Create a XML file with XmlTextWriter and Modify/Update some Existing
Starting with a already existing installscript 11.5 installer, we created a update installer (differential
I need to update existing users IsApproved status in the aspnet_Membership table. I have
With a DataContext and a blank file-based database that already exists , is it
I have an existing database with the table Transactions in it. I have added
Possible Duplicate: update django database to reflect changes in existing models I've used Django

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.