Don’t you feel boring sometimes when you have to write an script to insert multiple rows in a table and you do not have any other choice except writing multiple insert statements? In one of my previous posts I showed a way to insert multiple rows by using UNION ALL but wait! there is another [...]
Posted Under: Uncategorized
This post was written by
namwar on August 31, 2007
Comments (0)
Logging all the data related activities to maintain an Audit Trail is always a prime requirement of sensitive applications. People either use Triggers to manage Audit Trails or use middle tiers to maintain the log by themselves.SQL Server 2008 has introduced a completely new framework targeted for Audit Trail maintenance. This framework consists of in-built [...]
Posted Under: Uncategorized
This post was written by
namwar on August 30, 2007
Comments (0)
Today’s scientist use highly precise instruments and take measurements of time at nano seconds level. This level of precision needs a storage system which can provide storage of time and date data at nano seconds level and can easily scale up with future needs.SQL Server 2008 has introduced a completely updated set of Date and [...]
Posted Under: Uncategorized
This post was written by
namwar on August 29, 2007
Comments (0)
Everyone is talking about SQL Server 2008 these days because it is coming up with lots of enhancements in nearly every area. One of these enhancements is the introduction of a new data type called HierarchyID. This data type is introduced to address one of the typical problem faced by nearly every medium to large [...]
Posted Under: Uncategorized
This post was written by
namwar on August 28, 2007
Comments (0)
SQL Server 2008 has introduced a new statement called MERGE which will combine the logic of INSERT-IF NOT EXITS and UPDATE-IF EXISTS.MERGE statement will give you the ability to write one single statement which will update the row if it already exists otherwise it will insert a new row.Additionally, MERGE statement also enable you to [...]
Posted Under: Uncategorized
This post was written by
namwar on August 27, 2007
Comments (0)
With many other new enhancements, SQL Server 2005 has introduced another very useful operator calledAPPLY, which makes life very easy for some complex problems.APPLY operator works as follows:1. It applies a table valued function to each row of the table by using the column values as parameters.2. Resulting rows are then returned [...]
Posted Under: Uncategorized
This post was written by
namwar on August 25, 2007
Comments (0)
Sometime we need to pad leading zeros to numeric values so that they can appear having same widthlike 00001,0022,0934 etc. Following code demonstrates the technique to pad leading zeros in front of digits.
–Variable to hold max lengthDeclare @m_maxLength int
–Create a test tableDeclare @m_testTable table (sampleValue int)
–Insert some sample valuesInsert into @m_testTable values (1)Insert into @m_testTable [...]
Posted Under: Uncategorized
This post was written by
namwar on August 24, 2007
Comments (0)
Microsoft has announced another server software called “Microsoft Performance Point Server“. According to the information available up till now, this server will act as a bridge between Microsoft Office and SQL Server Business Intelligence architecture. So far so good, but don’t you think it looks similar as what Microsoft promised for SharePoint Server? I [...]
Posted Under: Uncategorized
This post was written by
namwar on August 23, 2007
Comments (0)
I was browsing through the newsgroups and found a very interesting white paper link about SQL Server 2005 Plan caching and batch recompilations. This white paper is a must read for anyone who really wants to master the query tuning and optimization strategies.You can read this white paper here
Posted Under: Uncategorized
This post was written by
namwar on August 21, 2007
Comments (0)
Sometimes we need to disable triggers to perform some tasks. Disabling the trigger by going to each table is very tedious. Following is avery quick way of disabling all triggers on all tables of the given database in a single statement.
sp_msforeachtable “ALTER TABLE ? DISABLE TRIGGER all”
To enable all triggers, you can use following [...]
Posted Under: Uncategorized
This post was written by
namwar on August 20, 2007
Comments (0)