Archive for the ‘SQL’ Category

Managing connections with Oracle or any other Database

March 27th, 2011 1 comment

In case that we have small number of clients that contributes data from Database (our desktop application is classical example where we have exact number of clients known during deployment stage), dilemma is to close or leave database connections open permanently during our Application life time. It’s very important to make right decision at design stage.

Additional aspect that we need to consider of – its Multithreaded environment can cause


from Oracle, we have experienced this problem when the same open connection is used from different threads simultaneously.

Following C# code demonstrate simple example of connection usage.

using (DALFunctions  dal = new DALFunctions())




Read more…

Categories: SQL Tags: ,

Pivoting Data in SQL

March 16th, 2011 No comments

I believe that may of you came across the need to pivot, or simply rotate some SQL data from columns to rows, while working with dynamic attributes or key-value pares tables.

For example I have the following database structure:

And of cause each object can have various number of associated attributes. Assuming that I need to fetch all attributes from the relevant objects, while attributes are aligned to the object in the same row, it becomes quite a trivia to perform.

Read more…

Categories: SQL Tags: , , ,