Showing posts with label T-SQL. Show all posts
Showing posts with label T-SQL. Show all posts

Tuesday, 11 December 2012

SQL: the power of left, right and IN

   


As the title mentions, in this short article I will show you how to benefit from the use of the left and right SQL functions together with the IN operator.
Before doing so, we need to understand what are the two functions and what the operator is doing.
Please follow me and see what we can do!

Friday, 12 November 2010

SQL Server: How to deal with Acucobol date fields

   


As explained in a previous post, you can connect your Sql Server to an Acucobol db using AcuODBC. In the last part of the article I explained that there are performance issues when you query a linked server with OpenQuery and that it is better to import relevant data from the linked server to a Sql Server table in order to benefit from all the features available through stored procedures, triggers and so on.
I run some queries overnight  using SQL Scheduler to keep my local tables updated against the Acucobol tables, but, when importing the data, in some way I manipulate them to make them easier to query. What I found important in terms of performance, is to convert date fields from int to smalldatetime format. Furthermore, when importing data I insert into the newly created Sql Server table an identity field and set it as primary key.
Let's break down the query and I will explain it bit by bit.

Friday, 10 September 2010

Dynamic keywords and description meta tags

   


After publishing the "Are keywords and description attributes useful?" post, I will explain how to create dynamic keywords and description meta tags. If you have a dynamic page which, for example, retrieves records from a table, according to query parameters, it is quite easy to populate the meta tags with relevant keywords or a description strictly related to the recordset itself.

Monday, 12 July 2010

Dynamic Columns in T-SQL

   


In one of my projects I had to create a SQL query which has dynamic columns. The reason why was related to the fact that I needed to create a pivot table (and that is quiet easy) with dynamic columns. The challange was tricky for me at the time, but when I understood the basics behind it I started to use the method in different ways... and that solved a lot of troubles.