Tuesday, April 22, 2014

@@TRANCOUNT - SQL SERVER

Returns the number of BEGIN TRANSACTION statements that have occurred on the current connection.

The BEGIN TRANSACTION statement increments @@TRANCOUNT by 1. ROLLBACK TRANSACTION decrements @@TRANCOUNT to 0, except for ROLLBACK TRANSACTION savepoint_name, which does not affect @@TRANCOUNT. COMMIT TRANSACTION or COMMIT WORK decrement @@TRANCOUNT by 1.

PRINT @@TRANCOUNT
--  The BEGIN TRAN statement will increment the
--  transaction count by 1.
BEGIN TRAN
    PRINT @@TRANCOUNT
    BEGIN TRAN
        PRINT @@TRANCOUNT
--  The COMMIT statement will decrement the transaction count by 1.
    COMMIT
    PRINT @@TRANCOUNT
COMMIT
PRINT @@TRANCOUNT

Saturday, April 19, 2014

Cannot register the hard disk xxxxx because a hard disk xxxxxx with UUID xxxxxxx already exists in Oracle VirtualBox

Failed to open the hard disk .

Cannot register the hard disk because a hard disk with UUID already exists.

Solution

  • Open the Command Prompt
  • Change the directory to where VirtualBox is installed (Default: C:\Program Files\Oracle\VirtualBox)
  • Type the following VBOXMANAGE.EXE internalcommands sethduuid [PathOfNewVHD]

How to Setup a VM to install TFS 2013?

Install in the following order:

  • Install Windows Server 2012 Standard or Data Center Edition
  • Promote the server as Domain Controller (optional)
  • Install SQL SERVER 2014 Developer Edition with the features Database Engine Services, Full-text and semantic extraction for search, Analysis Services, Reporting Services - Native, Management Tools - Basic, Management Tools - Complete
  • Install TFS 2013 Update 2

TF255146: Team Foundation Server requires SQL Server 2012 SP1 (11.00.3000) or greater. The SQL Server instance XXXXXXXX you supplied is version 12.0.2000.8.

This issue raised when trying to install Team Foundation Server (TFS) 2013 over SQL 2014 database. Make sure to install TFS 2013 Update 2 as it will support SQL SERVER 2014 while the previous version supports up to SQL SERVER 2012.

Monday, April 14, 2014

Continue loop in SSIS even after an Error

Scenario

Got set of messages to process using a For Loop in SSIS. But when there is an error in one message then the rest of the messages are not processed. Given the child package failed the parent package is also failed. How to continue with the messages even a message has errors?

Solution

Set the MaximumErrorCount property of the For Loop container to 0. FailPackageOnFailure: When set to True, the failure of the task or container results in the failure of the package in which it is defined. FailParentOnFailure: When set to True, the failure of the task or container results in the failure of its container. MaximumErrorCount: Property specifies the maximum number of errors that can occur before the item fails.

Sunday, April 13, 2014

Get Date and TimeStamp from an FTP Server

    FtpWebRequest request = (FtpWebRequest)WebRequest.Create (serverUri);
    request.Method = WebRequestMethods.Ftp.GetDateTimestamp;
    FtpWebResponse response = (FtpWebResponse)request.GetResponse ();
    Console.WriteLine ("{0} {1}",serverUri,response.LastModified);