Friday, 27 June 2014

1.20 - SQL 2012 linked server query and loading a result set into an object

I recently upgraded an environment into a SQL 2012 environment from SQL 2008. Today one of the devs could not run a distributed query to one of the linked servers, but only if it returned a result set into a temporary table or table variable.
The query was running a Stored procedure that returned a small subset of data, It would run perfectly fine on its own but as soon as it ran with the additional task of adding the data into a temp table it blew up with the error
The partner transaction manager has disabled its support for remote/network transactions. and followed up with The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "[SERVERNAME]" was unable to begin a distributed transaction.

I checked the configuration of the new servers and MS DTC was configured in the exact same way from the old ones but for some reason SQL 2012 seemed to be dealing with it differently (or at least the linked server provider was).
After I amended the local DTC config to accept network DTC access and for remote clients(inbound and outbound) all was well.

Wednesday, 19 March 2014

1.19 - Running a 32bit SSIS Package in a 64bit SQL Environment with the SQL Agent

I have always seen lots of issues with this whenever I have been performing these tasks and I have now found a method that ensures that it will work. This is as follows:

  1. Change the SSIS package to run as 32bit
  2. Import the SSIS package as a file system deployment
  3. Create a credential on the SQL server
  4. Create a Proxy for the above credential for the cmd.exec
  5. Create a sql agent job to use a Operating System (Cmd Exec) in the job step
  6. Set the SQL agent to use the proxy account that was created above
  7. Now here's the part that forces it to use the 32bit  - Set the job step to call the 32bit version of the dtexec.exe (i.e. "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /f  "[package file location and name]")
I hope this helps others as this is was a godsend for me

Monday, 17 March 2014

1.18 - SQL Aliases to Named Instances

This can be a tricky issue to resolve and there is not too much about it that I have found. However, there is a nice article here (setting-up-aliases-on-sql-server) that describes a nice way of sorting this. (use link for images)

Setting up aliases on a SQL Server with multiple instancesThis article will explain how to set up multiple aliases for a SQL Server running multiple instances. Aliases can be an important part of a company's disaster recovery plan as well as aiding in the replacement of an underlying physical or virtual server. By abstracting the name a user or application uses to connect to SQL Server, we gain the ability change the underlying hardware with a few changes to DNS.
At the end of this article, there will be 3 instances of SQL Server running that can accessed either by their SQL instance names or the 3 aliases we are going to create, SQLAlias1, SQLAlias2, SQLAlias3.
Our initial setup is a physical server named WinServer and 3 instances of SQL Server 2008. The first instance is the default instance, with the other two instances named Instance2 and Instance3. We can connect to all 3 instances by using the names WinServer, WinServer\Instance2, and WinServer\Instance3.
Once all 3 instances are setup, we need to add 2 more IP addresses to the WinServer. There is one IP address already assigned to WinServer, By adding two new IP's, and, WinServer can be accessed by any of the 3 IP's on the network. Below are screenshots on how to add the 2 new IP's. You may need to coordinate with your network administrator.
Add the IP's in the Local Area Connection Properties of the NIC.


Add the 2 addresses

Uncheck Register this connection's addresses in DNS

Now that the IP's have been created, we need to move into DNS to configure our host names and aliases. Again, you may need to coordinate with your network administrator.
WinServer (the physical machine) must be setup as a static IP in DNS. In this instance,, which will point to the default instance on WinServer, will be setup as a DNS alias or CNAME. Basically, it is a pointer to WinServer.SQLAlias2, which will point to WinServer\Instance2, will be setup as a new Host (A) record in DNS with an address of, which will point to WinServer\Instance3, will be setup as a new Host (A) record in DNS with an address of these are setup, you may have to flush your DNS cache and re-register. You can do this by running the following commands in the command prompt. ipconfig /flushdnsipconfig /registerdnsYou should now be able to ping all 3 aliases and each should resolve to their associated IP address:SQLAlias1: that everything has been completed on the DNS side, open up SQL Server Configuration Manager on WinServer. There, under SQL Server Network Configuration, you will see the protocols for the 3 instances of SQL Server.

Configure the protocols for each instance one at a time. First, the protocols for the default (MSSQLServer) instance.

Double click the TCP/IP protocol set Listen All to No.

Now, move to the IP Addresses tab and enter the 3 IP Addresses (,, all with the port of your choosing. I chose to keep the default port of 1433 for all three instances. Notice that on the first instance, the Active and Enabled is set to Yes on the IP address of while the other two addresses have Active set to Yes, but Enabled is set to No. Dynamic Ports on the first instance is set to blank, not 0. 

Select OK. You will get a warning box that these changes will not take affect until the instance is restarted, but I chose to wait until I'd configured all 3 instances before restarting the 3 SQL services.
Now that the TCP/IP protocol is configured on the default instance, we will configure SQLInstance2 and SQLInstance3 in the same way, with a few subtle differences.
On the TCP/IP protocol setup of SQLInstance2, we will once again set the Listen All to No.

Inside the IP Addresses tab, enter your 3 IP Addresses just like on the first instance. The difference here is that all 3 will again be set to Active, but only and will be set to Enabled, with TCP Dynamic Ports set to 0 on the address. This is done so we can still access the WinServer\Instance2 instance by that name and not just the SQLAlias2 alias.

For SQLIntance3, the TCP/IP protocol setup is basically the same as SQLInstance2, execpt for 1 difference. Listen All will still be set to No and the address will still be set to Yes for Active and Enabled, along with TCP Dynamic Ports set to 0. The different is that on the address, it will be set to No for Enabled, while Enabled is set to Yes for the address.

Note: On all 3 instances, under the IPAll section of the IP Addresses, TCP Dynamic Ports and TCP Port will always be blank.
If you restart all 3 instances now, you will be able to connect to the default instance but will most likely get the following error message when connecting to SQLInstance2 and SQLInstance3. 
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. (Microsoft SQL Server, Error: 18452)If that’s the case you will need to add a new DWORD registry entry under HKEY_LOCAL_MACHINE\SYSTSM\CurrentControlSet\Control\Lsa called DisableLoopbackCheck and set to 1.
Once that is set you should immediately be able to connect to all the instances on you server using either the SQL instance name or the new aliases setup in DNS.

Friday, 7 March 2014

1.17 - Run In The SSIS Deployment Utility On Machines With Multi Edition Instances

Run "C:\Program Files (x86)\Microsoft SQL Server\[SQL EDITION]\DTS\Binn\dtsinstall.exe" "[FileLocation.SSISDeploymentManifest]"

Tuesday, 4 March 2014

1.16 - SQLBits Registration

It's a shame that this is based in Telford, rather than London but ...SQLBits Registration now open and can be found at