-
SQL Update if Record Exists or Insert
Quite often we need an approach where we need to Insert record if it is not already present. Sometime to manage relationship. There are few different way of doing it, like “If Exists”, or “Insert on Duplicate Key” (mysql) but the best I found is one from MSDN Blog Entry ( http://blogs.msdn.com/b/miah/archive/2008/02/17/sql-if-exists-update-else-insert.aspx) The approach is…
-
Advance SQL: Finding Hierarchical data using Recursive CTE
Often we have a Table that store Hierarchical data, such as any shopping cart will have product category in table that store parent table within same table. We often use such information. The typical structure of table is ID, Name , ParentID Where ParentID is ID within same table or for Top level it is…
-
Reading Large Binary Files: Child Play
Yes, that was funny title, but after your experience it you will agree to me. So, here is the story. I have been working on a software that read some recording from hardware device to database, we have 45 records per second for 30 days, so it is about 30x24x60x60 record entry with 45 columns…
-
Database Optimization
Well, most of program use database for their web application. Eventually all web application does have database. But how many of those web application really works good. Well quite few. I am in web programming for more than 7 years now and during these years I have seen lot of developers building website using PHP…
-
Case Sensitive Search in SQL Server
Mysql mostly provide a Case sensitive search because of its default collate configuration. However SQL server use different collate and hence by default it is not case sensitive. It is good to not having case sensitive search by default, as except password compare you most often doesn’t need case sensitive search. Do you? well I…
-
Sql optimization
Today, I experience a slow down in one of website I just finish building up. It was a intereting project which has ability to create Dynamic form and hence the related dynamic database tables. But the problem was in part where we preload user information and later show them on our dynamic forms when user…
-
Reseed Auto Increment Value in SQL Server
You can reseed the Auto increment field to desire number by using following SQL statement [I think it is specific for SQL Server only] other Database have their own methods. DBCC CHECKIDENT (<TableName>, RESEED, 0) Works great for me on Sql Server 2008