Managing transactions

May 19, 2009 at 12:53 pm | Posted in IT | Leave a comment

If you have a container within the Control Flow and you want the transaction to rollback if one of the tasks withing the container fails, then you need to do the following:

1- On the package level, make sure that transaction option is Supported

2- On the container, make sure that the transaction option is Required

3- On the sub tasks, make sure that transaction option is Supported

Using expressions for task precedence constraint

July 10, 2007 at 11:11 am | Posted in IT, SQL Development, SSIS | Leave a comment

When using a variable in evaluating a precedence constraint, the variable should start with @, e.g. variable User::Count should be refered to as @Count

ssis_precedence.jpg

Symmetric keys in SQl 2005

June 25, 2007 at 9:24 am | Posted in IT, Programming, SQL Development | Leave a comment

Use Symmetric Keys to encrypt the content of your data before inserting into the database.

Create Symmetric Key: 

CREATE SYMMETRIC KEY MyKey WITH ALGORITHM = DESENCRYPTION BY PASSWORD = ‘MyPassword’

Open Symmetric Key for use:

OPEN SYMMETRIC KEY MyKey DECRYPTION BY PASSWORD = ‘MyPassword’ Encrypt data using Symmetric Key: 

SELECT ENCRYPTBYKEY(KEY_GUID (‘MyKey’),‘Hello World’)

Decrypt data using Symmetric Key: 

SELECT CONVERT(VARCHAR,DECRYPTBYKEY(ENCRYPTBYKEY(KEY_GUID (‘MyKey’),‘Hello World’)))

Paging Records using SQL 2005 ROW_NUMBER() Function

November 20, 2006 at 1:21 pm | Posted in IT, Programming, SQL Development | Leave a comment

To retrieve data from an SQL 2005 database in pages, use ROW_NUMBER( ) function.

Records will numbered starting from 1. ORDER BY should be used to sort out data before numbering the records.

–This Example returns 20 Products as Page 1

SELECT ProductName,

WhenProduced

FROM

( SELECT ROW_NUMBER() OVER (ORDER BY WhenProduced DESC) AS RowNumber,

ProductName,

WhenProduced

FROM

ProductProductions

) AS ProductProductionWithRowNumbers

WHERE

RowNumber >= 1 AND RowNumber <= 20

–This Example returns 20 Products as Page 2

SELECT ProductName,

WhenProduced

FROM

(SELECT ROW_NUMBER() OVER (ORDER BY WhenProduced DESC) AS RowNumber,

ProductName,

WhenProduced

FROM

ProductProductions

) AS ProductProductionWithRowNumbers

WHERE

RowNumber >= 21 AND RowNumber <= 40

Fail to execute store procedure in OLE DB Source in Data Flow

November 7, 2006 at 11:23 am | Posted in IT, SQL Development, SSIS | Leave a comment

When using SSIS for SQL 2005, running an SQL Command (Procedure) using an OLEDB Object may cause this error to trigger.

Use “SET NOCOUNT ON” in your procedure code to eleminate this error

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.