Archive

Archive for the ‘Visual Studio’ Category

Visual Studio SQLCompare does not Compare SQLCMD Variables correctly

November 29th, 2013 2 comments

The problem

When using the Visual Studio SQL Compare to compare your database schema to your physical database it returns heaps of false positives, where SQLCompare is suggesting that your CMD variable does not match what is on the database.

The Solution

SQLCompare uses the default or local CMD variables that you have on your project when performing the compare.

You need to ensure the default variables match the target database you are comparing against.

To change your defaults open the properties of your Database project, switch to the “SQLCMD Variables” tab and edit the defaults.

When you get your variables in alignment with your target comparison database you will get a true indication of the differences.

VN:F [1.9.22_1171]
Rating: 7.3/10 (3 votes cast)

Categories: SQL Server, SSDT, Visual Studio Tags:

Post Deployment Script, 72006: Fatal scripting error: Incorrect syntax was encountered while parsing

July 12th, 2013 No comments

The Problem

You create a post deployment script, with a statement like;

:r .\Static Data\Insert Seed Values.sql

The system throws an error and will not build:

72006: Fatal scripting error: Incorrect syntax was encountered while parsing ‘Data\Insert’
[/chsharp]

The solution

There are two problems:

  1. The post deployment script does not like spaces in the file paths, so quote the file path in “double quotes”.
    :r ".\Static Data\Insert Seed Values.sql"
    
  2. The post deployment script runs in SQL CMD mode, so whilst ever you have the script file open it will throw syntax errors either
    1. Close the post deployment script; or
    2. Turn on SQL CMD mode on the file, (in 2012 with latest SSDT this is the last icon in the toolbar

      SQLToolbar
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Categories: SQL Server, SSDT, Visual Studio Tags:

Create Visual Studio Project with the correct directory structure

September 10th, 2010 No comments

This ones just for me.

I have been using TFS and when I read the best practice documentation for how to setup your projects I have ended up having a preference for how i like my directory structure.

Assume you have a project  call BudgetForecast, I would  end up with a folder structure like

c:DevBudgetingProjectMainSourceBudgetForecastSource

Under the BudgetForecast directory would be the BudgetForecast.sln and in the Source subdirectory would be the Project file.

So how to get Visual studio to do that.

  1. Create a new solution
  2. Set the location to c:DevBudgetingProjectMainSource
  3. Set the Name to “Source” (this also sets the solution name)
  4. Set the SolutionName to “BudgetForecast”
  5. make sure the “Create Directory for Solution”  is picked
  6. click OK

Your soltuion is now created but your project is called source, so just rename to project to BudgetForecas, save that and your done.

I wrote this as I can never remember whether Name or solution Name needs to be changed to source and invariably I get it wrong

Cheers

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Categories: Visual Studio Tags: