freshers/Experienced Dotnet jobs
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

21/07/2011

How to delete duplicate rows from tables with no primary key!

Ans) Use SET ROWCOUNT value

Ex:-     SET ROWCOUNT 2
           DELETE FROM table_name WHERE somecolumn1=somecolumnvalue
           SET ROWCOUNT 0

         Imagine a table having 3 similar rows.The above delete statement executes 2 times deleting the extra 2 rows.Dont forget to set ROWCOUNT to 0 after succesfull query execution.



17/07/2011

INDEX Statement

  • Indexes are used to search/query the data from the table, without reading the entire table.
Advantages:-
  1. Allows the application to find the data fast from database thereby increasing the query speed.

16/07/2011

DROP,DELETE & TRUNCATE

DROP:- Tables,Databases,Indexes can be easily removed using DROP Statement.
           
EX:-DROP TABLE table-name
                 Deletes table completely from database.

 similarly DROP INDEX index-name
              DROP DATABASE database-name

06/07/2011

What is the advantage of SET NOCOUNT ON ?

  • Use Nocount at the begining of all your Stored procedures,Functions and Triggers
In case of regular T-sql statements(Insert,Update,Delete,Select) execution, we observe a message like some 20(rows) affected in the result window.This is actually a message database return internally to the client.This costs our application in terms of performance because information is sent back to us(client).

This intensifies when we have many operations(Insert,Update,Delete) in a stored procedure.That means each operation returns internal message within the stored procedure execution cycle.

Difference between ADO & ADO.Net ?


Difference between Data Reader & Data Set ?


Data Set ?


Data Adapter


Data Reader


LIKE Statement ?


Explain Drop Query ?


TRIGGERS ?


What is a View ?


Primary Key Vs Unique Key ?


Primary Key Vs Foreign Key ?