SQL – Index Rebuild / Index Reorganize

Index Rebuild will drop the existing Index and it will recreates the index. ALTER INDEX index_name ON databasename.tablename REBUILD Index Reorganize physically reorganizes the leaf nodes of the index. ALTER INDEX index_name ON databasename.tablename REORGANIZE Index should be rebuild when index fragmentation is most of the time great than 40%. Index should be reorganized whenContinue reading “SQL – Index Rebuild / Index Reorganize”

SQL – Search Text in Stored Procedure

There is below few questions which will ask you while Interview or Any time …How can I find if particular table is being used in the stored procedure?How to search in stored procedures?How can I do dependency check for objects in stored procedure without using sp_depends? The same feature can be implemented using following script.Continue reading “SQL – Search Text in Stored Procedure”

How to Delete Duplicate Records from Table

Below query is useful to delete the duplicate Ids data from table. The table must have identity column, which will be used to identify the duplicate records. CREATE TABLE StudentDetail(ID INT IDENTITY(1,1),StudentID INT,Name VARCHAR(10),Address VARCHAR(100)) INSERT INTO StudentDetailSELECT 10001,’Test1′,’Mumbai’INSERT INTO StudentDetailSELECT 10002,’Test2′,’Mumbai’INSERT INTO StudentDetailSELECT 10003,’Test3′,’Mumbai’INSERT INTO StudentDetailSELECT 10004,’Test4′,’Mumbai’INSERT INTO StudentDetailSELECT 10005,’Test5′,’Mumbai’INSERT INTO StudentDetailSELECT 10001,’Test11′,’Mumbai’INSERT INTOContinue reading “How to Delete Duplicate Records from Table”

Top 10 SQL Interview Questions

What is SQL ?SQL is Structured Query Language . This is a standard language used to perform tasks such as INSERT/UPDATE/DELETE and SELECT of data from a database. What is Database ?Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. Constraints in SQL ?NOT NULL –Continue reading “Top 10 SQL Interview Questions”

Create your website with WordPress.com
Get started