Category Archives: Database

250+ SQL Queries Interview Question Answers

SQL Interview Queries Question / Questions Answers This is a never ending topic and there is no limit to questions that all depends on profile and interviewer. I am trying my level best to divide questionnaire based on Experience in Query Writing skills 5+ Years of Experience (Expert) 2-5 Years of Experience (Intermediate) 1-2 Years [...]

50 Database Optimization TIPS

Database Optimization TIPS helps any system to perform work efficiently and quickly. SQL Server Performance tuning is very wide subject and there are a lot of different pieces to troubleshoot a poor performing application. Connectivity / Network Server Hardware Operating System SQL Server Database Query The basic principle of Optimization / Tuning is Profile First [...]

Script to compare object code between two Production and development databases

Question : How to compare SQL Server Development and production boxes (two databases) in terms of object definition like Stored Procedures Triggers Views Function OR SQL Script to indentify databases objects where definition is not same. Solution This is a stored procedure to compare the code of the objects (Stored Procedures , Triggers , Views [...]

Script to check when database objects were they were changed last time

Script to check database when was database objects were changed last time Following script will list down  database objects and their corresponding creation date and last modified date. — ***********************************************************************************/ — Description : Script to check the objects and the date they were changed for a database — Following script will list down database objects [...]

How to Purge data in SQL Server ?

What is Data Purging ? Data purging is just deleting the old data from the tables in the database. Many OLTP databases are in need of a data purging solution. Deleting data that is no longer used by the application makes it possible to reduce the database size and, consequently, the application response time. Keeping [...]

How to Restore SQL Server 2008 backup in SQL Server 2005

Can we restore a SQL Server 2008 backup in SQL Server 2005? NO, we can not restore higher version of databases to a lower version. It is not possible to restore a database from a backup of a newer version to older version as database backups are not backward compatible. There is a workaround to [...]

How to Setup Mirroring in SQL Server ?(Screen Shots)

What is Mirroring in SQL Server ? Database mirroring is an alternative high-availability solution to failover clustering in SQL Server. Database mirroring supports automatic failover, but does not require cluster-capable hardware, and can therefore provide a cost-effective alternative to failover clustering. In this Article, we will implement Mirroring with witness Server and will Automatic Failover [...]