How to find out duplicate records (duplicate data) in a SQL Server table
Records duplication or data redundancy is the common issue we face with SQL Server table. In this article we will find out all the duplicate records (duplicate data) in a SQL Server table. We have to use the group by with having command to get the duplicate records (duplicate data).
SELECT column_Name FROM Table_name
GROUP BY column_Name
HAVING count(column_Name) > 1
SELECT studentName FROM tblStudentDtl
GROUP BY studentName
HAVING count(studentName) > 1
This technique is good while fatching single column, if you want more column to fetch you need to modify it like…
Continue reading “How to find out duplicate records (duplicate data) in a SQL Server table”
GridView Custom Paging in ASP.NET 3.5 with SQL Server Stored Procedure
GridView — Displays a set of data items in an HTML table. ASP.NET GridView control enables you to display, sort, page, select, and edit data.
Default gridview paging works best when you deal with limited pages. If there are more pages then, the performance suffers. In this case direct jump to desire page is a good alternative.
I have deal with a problem on GridView while working on user control (.ascx). I have a user control (.ascx) with GridView in it. I have used Stored Procedure to retrieve data. Bounding data to gridview display all the records and Default paging setting not work for me. Here Custom Paging helps me and only those database records that need to be displayed get retrieved. Using GridView Custom Paging solve the Issue for me.
Continue reading “GridView Custom Paging in ASP.NET 3.5 with SQL Server Stored Procedure”
Create Temporary virtual table (or a records set) with SQL Server Stored Procedure
Some time we need to create a virtual table to manipulate data without affecting the actual data in the actual table. You can create a virtual table by two ways. Using CREATE TABLE statement and with DECLARE statement.
Let’s consider, I have student table(tblStudent) contain sName, sAddress, ClassId and class table(tblClass) contain classId and ClassName. Now I want to SELECT Name, Address and ClassName based on string pattern and Stored it to a virtual table.
First of all take a look at our table structure…
|Table 1 – tblStudent
Continue reading “Create Temporary virtual table (or a records set) with SQL Server Stored Procedure”