SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

New York City .NET

The author of the NYCdotNet blog is a VB.NET and SQL server developer living and working in New York City. The author seeks to promote clean, readable, efficient code in both VB and SQL from design to development, deployment, and application maintenance.

Surface: Standard Onscreen Keyboard

If you feel that the default on-screen keyboard on the Surface RT isn't sufficient, you can enable what I would say is the "pro" keyboard via the settings.

  • Drag in from the right hand side to show the charms and click Settings.
  • On the bottom of the settings window, click…

Read more

0 comments, 1,149 reads

Posted in New York City .NET on 19 November 2012

SQL in the City - New York 2012

I was able to attend the SQL in the City event in New York this past Friday.  I highly recommend that anyone who can spare the time and travel should attend the next SQL in the City day in your area.  I found it to be a very well put-together… Read more

0 comments, 647 reads

Posted in New York City .NET on 1 October 2012

PowerShell: Redirecting Console Output and Error Output to a Variable and E-mailing it

I recently had the need to script the execution of a command-line utility and thought it would be a good learning experience to try doing it with PowerShell.  The utility would sometimes output to the STDOUT, but would also send its output to STDERR if there was a problem.  This… Read more

1 comments, 18,834 reads

Posted in New York City .NET on 28 August 2012

Fix: Crystal Reports Shows Red X Across Entire Page When Report Run Inside Visual Studio

I was googling (with Bing AND Google) like crazy for a solution to this, but didn't find one from any of the open resource sites, so I figured I'd blog about my fix for this to help the next poor dev to come along.

I was getting user feedback that… Read more

0 comments, 1,352 reads

Posted in New York City .NET on 14 August 2012

Enabling "Open Project Folder" for project types that don't support it

One annoying thing about SSIS (2008) and some of the other project types in Visual Studio is the lack of an "Open Project Directory..." option on the project right-click menu.  Visual Studio's "Tools" menu can provide a work-around this.
Go to Tools... External Tools... and add a new entry… Read more

0 comments, 658 reads

Posted in New York City .NET on 18 July 2012

A Pattern for PIVOT

Use of the PIVOT operator in T-SQL has always been tantalizing yet confounding to me.  It offers the promise of more concise and expressive code compared to a subselect pattern, yet I've always found it difficult to get the code just right so that I could apply it in a… Read more

0 comments, 1,903 reads

Posted in New York City .NET on 8 July 2012

Excellent SSIS 2012 Upgrade Video

This presentation gives an excellent overview of the process of upgrading SQL Server 2008 SSIS packages to work with SQL Server 2012 SSIS.  I’m very impressed at the much-improved capabilities for deploying SSIS packages in a less-scary way using package and project parameters, support for SSIS “environments” (“prod”, “dev”, “test”,… Read more

0 comments, 1,222 reads

Posted in New York City .NET on 24 June 2012

Another Way To Insert Many Rows Very Fast From Your .NET Application

There was a great deal of feedback to my previous post One Way To Insert Many Rows Very Fast From Your .NET Application.

The post focused on the performance benefit of using a single SQL statement with an XML-based parameter to do inserts of many rows to a table… Read more

3 comments, 3,269 reads

Posted in New York City .NET on 15 May 2012

One Way To Insert Many Rows Very Fast From Your .NET Application

This is my attempt to explain something that I have wanted to figure out for a long time.  I have read many articles on this very subject but they always seem to fall short for various reasons - generally by including way more detail or complexity than is necessary to… Read more

17 comments, 62,374 reads

Posted in New York City .NET on 11 May 2012

One Way to Work Around the .NET Setup Project’s Picky Version Number Behavior

If you don’t change the version number of your .NET project output every time you create a setup package, you may have found that it’s difficult to have the Setup program reliably uninstall the existing version of your software before installing your update.

Here’s how to add a batch file… Read more

0 comments, 1,613 reads

Posted in New York City .NET on 10 May 2012


I recently discovered this great little free Visual Studio Add-in that allows pasting text as preformatted strings in VB or C#.

Meaning it will turn this text:

This is line 1.

This is line 2.

To this when pasted:

“This is line 1.” & vbCrLf & _

“This is line… Read more

0 comments, 751 reads

Posted in New York City .NET on 2 February 2012

Case Sensitive searches in T-SQL

I just ran into an issue with one of my applications where a SQL statement had updated a status code field to a lower-case status code such as “active”.  We were expecting “Active” in the application and as a result our application began exhibiting odd behavior.  There are a host… Read more

0 comments, 2,465 reads

Posted in New York City .NET on 19 January 2012

Excel for the DBA, Part 1–The Basics

This will be a series of handy hints for people that know SQL and are frustrated by Excel.  I am going to be writing this for Excel 2007 (what I currently have at work) but the tips should work for most recent versions.  The SQL stuff should also work with… Read more

0 comments, 1,788 reads

Posted in New York City .NET on 6 December 2011

An Attempt to Make SSIS Package Deployment More Reasonable

Full disclosure: There might be a better way to do this.  I am not aware of it.


  1. Maintaining multiple DB environments (Local, Shared Dev, Staging, Prod) means needing to maintain multiple SSIS environments.
  2. SSIS packages are tricky to configure using the existing toolset – it’s easy to accidentally use…

Read more

0 comments, 1,394 reads

Posted in New York City .NET on 3 November 2011

Save a step: Using Computed Columns in a Table Variable (or Temp Table)

One of the databases that I support reports all money values in both the local currency and US Dollars.  Very often we will do all of our calculations in a table variable using the local currency and then calculate USD equivalents at the very end.

With this methodology, adding a… Read more

1 comments, 13,113 reads

Posted in New York City .NET on 28 October 2011

Tobias Ternstrom’s Great Denali Preview

Tobias Ternstrom from Microsoft gave a great talk at Tech Ed regarding upcoming features of SQL Server Denali.  His presentation was engaging, funny, and informative!

You can check it out on the Channel 9 site here (72 minutes):


I have to say that I am very excited about all… Read more

0 comments, 2,017 reads

Posted in New York City .NET on 30 June 2011

The Recursive CTE

(Yet another boring org chart example – except this one has multiple roots)

One of my apps has a hierarchial org chart in its database.  We don’t use the hierarchyid data type for this table.  Instead, each row in the table just has a unique org ID and… Read more

4 comments, 1,577 reads

Posted in New York City .NET on 18 May 2011

How to determine the current SSIS runtime environment

If you want to test if you’re currently debugging an SSIS package via BIDS/Visual Studio, or running normally via DTExec, you can use the following utility functions inside a Script task.

    Public Function SSIS_IsBIDS() As Boolean

        Return (SSIS_Environment() = "DtsDebugHost")

    End Function

    Public Function SSIS_IsDTExec()… Read more

1 comments, 2,044 reads

Posted in New York City .NET on 28 April 2011

Renumbering Rows in a Table Variable (or Table/Temp Table)

I was recently working on a data cleanup problem where I had to do lots of comparisons of one row to the next row and I was trying to do my best to avoid using cursor for this.  I was using the old trick of having an IDENTITY() field and… Read more

4 comments, 3,666 reads

Posted in New York City .NET on 18 February 2011

Creating a deep hierarchy with FOR XML

I have two tables in an application that I support.  One is called [Report], and the other is [ReportParameter]. 



      DECLARE @Report TABLE (

            ReportID INT PRIMARY KEY,

            Title VARCHAR(30),

            TitleHelp VARCHAR(100),

            ReportName VARCHAR Read more

2 comments, 11,468 reads

Posted in New York City .NET on 27 January 2011

Newer posts

Older posts