Skip to main content

Posts

Showing posts from August, 2016

Table Variable - Sql Server

Microsoft first time introduce Table variable in sqlserver 2000. it is alternative to using temporary table, but has some difference. Table variable acts like general table to  store, update, delete and delete records. Table variable store in TempDB in sqlserver. I will explain TempDB in later. Table variable declaration similar to CREATE TABLE Statement Declaration : DECLARE @MyProducts TABLE (        Id                 INT       , ProductName  VARCHAR ( 200 )       , Price              numeric ( 18 , 0 ) ) DML Operation: DML operation as it is general table operation. You can use tablevariables in batches, stored procedures, and user-defined functions (UDFs). We can UPDATE records in our table variable as well as DELETE records. ...

Efficiently Paging Through Large Amounts of Data (PageIndex, Page Size) -SQL Server

In this article you learn how to fetch data according PageIndex and PageSize. In web application, it is much more important to increase webform performance, loadbalance. In my development experience, some of table hold large amount of records (more than 2GB) and user need to shows records in GridView. But problem is when we select all records and loads in webforms, webform has crashed. In that case, I will simply solved with Table Variable and using Grid Page Number and Page Size. 1. Create Procedure CREATE PROCEDURE Load_Data_WithPaging @PageIndex AS INT , /*Selected Row Index of selected grid*/ @PageSize AS INT , /*Total page size of selected grid*/ @TotalRecords AS INT OUT /*used for display virtual page no*/ AS BEGIN SET NOCOUNT ON ; DECLARE @FromIndex AS INT = 0 , @ToIndex AS INT = 0 ; SET @FromIndex = (@PageIndex * @PageSize) + 1 ; /*First row no selection*/ SET @ToIndex = ((@PageIndex...