Skip to main content

Posts

Showing posts from November, 2014

Merge Statement Problem and Solution

  Merge statement is quite helpful if you want to do Upsert statement all together in single statement (It supports Insert, Update and Delete as well). It’s quite common in ETL process to write Merge statement to capture the changed data. If you are new and not familiar with Merge statement. Please refer to TechNet article. http://technet.microsoft.com/en-in/library/bb522522(v=sql.105).aspx Merge Tips by Itzik Ben-Gen: He has cover various scenario with example code where  Merge statement could raise the conflict and not able to produce the expected result. http://sqlmag.com/sql-server/merge-statement-tips Use Caution with SQL Server’s Merge Statement by Aaron Bertrand: He has explain some of the known bug of Merge statement along with Concurrency problem and impact on Trigger. http://www.mssqltips.com/sqlservertip/3074/use-caution-with-sql-servers-merge-statement/

Introduction to BigData / HDInsight

  I found a very nice and well comprehended video on BigData and it’s various component. Thanks to BigDSol for providing such a nice video. I must recommend this video for the person who want to understand BigData at a glance.

Shrinking database file

  Some time it’s important to shrink the database file specially log file that is quite huge to handle and it makes backup and restoration process quite expensive. Here is the code that you can try out to reduce the size of database / files.   USE <DB NAME> --- Set is simple recovery mode to reduce log size. let it be SIMPLE. --- if you want to chanage Replace SIMPLE with FULL ALTER DATABASE <DB NAME> SET RECOVERY  SIMPLE WITH NO_WAIT --- database log file name DBCC SHRINKFILE(<DB log file name_log>, 1) --- Database file name DBCC SHRINKFILE(<DB File name>, 1) Note: It’s not ideal way to do on production environment but it’s quick and good for development environment. Technorati Tags: SQL , Admin , Shrink DB , Shrink database file