advanced web statistics

SQL Server 2008 Save Not Permitted Dialog Box

I was creating some tables this evening in a SQL Server 2008 database this evening so that I could sandbox some MVC functionality for a current project.  I had designed the tables according to the tutorial only to find out that this wasn't the case.  I'll just log back in to SQL and make the necessary changes.  Easy.

When I added the missing column I went ahead and reordered to match the same order of the tutorial because, well; I am a little OCD at times.  I remember doing this in the past pre-SQL 2008 with no trouble.  This time I was hit with this:

Weird.  Again, I had never seen this before so I was a bit surprised.

According to SQL Server 2008 Books Online this can be caused by any of the following:

  1. Adding a new column to the middle of the table
  2. Dropping a column
  3. Changing column nullability
  4. Changing the order of the columns
  5. Changing the data type of a column

Really?  These all seem like fairly common tasks when working within a database.  As odd as this may seem (maybe there is a good reason for this?), there is a very easy fix.

From the Tools menu click on Options, expand Designers, click on Table and Database Designers.  Select or clear the Prevent saving changes that require table re-creation option.

Much better.  Back to work.

Tags: Database, SQL

SQL Build Script Creation

Just finished with a huge SQL build script for a  project I`ve been working on.  To most of you I`m sure it`s a pretty small build script; only about 5,500 lines of T-SQL!  Any tips on troubleshooting or streamlining the SQL build process?  I found that adding a print line right before each task was helpful in stepping through any errors.  This took me back to the ASP Response.Write days of debugging.

Are there any `best practices` when it comes to creating build scripts or is it just another one of those tedious tasks that takes patience and persistence?

The only "error" I am getting now is telling me that the user already has select permissions on a certain table.  In my opinion this really isn`t an error.

Tags: Database, SQL