Showing posts with label VSTS DB. Show all posts
Showing posts with label VSTS DB. Show all posts

Monday, July 06, 2009

Table does not show up in Data-Compare (VSTS)

When performing a data-compare in VSTS Database Edition (aka Data Dude), if you do not see one of the tables in your source or target databases – the reason is most probably very simple:

It does not have a primary key!

Spent many hours trying to figure this one out!

Thursday, June 18, 2009

TSD03006: User: [username] has an unresolved reference to Login [loginname]

I was getting this error everytime I tired to build my VSTS Database project. The project had been created as a “database project” and not a “server project”.

image

Because logins are server level objects, they do not get imported as part of the schema into the database project and hence you see the error.

The method that I used (and liked) to solve the problem was to create a 2nd database project which I setup as a “server project”. This one imported login ids and whole lot of other stuff. I then deleted all the other parts that belonged to the project, leaving behind only the login objects.

image 

Finally, I referenced this database project in my main database project.

image

Voila! and it worked!

Why do I prefer this (over just having a single server project)? because when you create your deployment script – there are 2 scripts created one thats based on the server project and the other based on your database project. In my case, the server project contains all kinds of crap that I typically never need unless I am standing up a new server, so I can ignore it and work only with the main database project.

VS Database Project - setvar Incorrect syntax near ':'

Today, I began evaluating using the new Visual Studio Team System Database Edition to manage and source control the database model used for one of our applications.

After importing an existing schema, I altered one of the columns (in Schema View) so as to create a deployment script which would then be run on the target SQL Server instance to modify it so as to match my changes in Schema View.

Instead of running the deployment script from within Visual Studio, I wished to run it from within SQL Server Management Studio (this is because I would like to hand off my DB script to the systems team to run the actual upgrade process).

So when I loaded up the script file into SQL Server Management Studio (I am using SQL Server 2005) and tried to run it I got this error : Incorrect syntax near ':'. And it was occurring on a setvar line.

:setvar DatabaseName "dbName"

The solution is super simple: You need to turn on SQLCMD mode before attempting to run the script (Query | SQLCMD Mode). image Or hit the button on the SQL Editor toolbar. 

image