Thursday, July 28, 2011
Weekly Links 1
15 Beautiful HTML5 Apps
Strange times in the world of Microsoft developers
App.config transform Visual Studio Add in
ASP.NET fails to detect IE10 causing _doPostBack is undefined JavaScript error or maintain FF5 scrollbar position
Analyze your Web Server Data and be empowered with LogParser and Log Parser Lizard GUI
Monday, July 18, 2011
How to Find Tables without Indexes?
Simply run the following query in the Query Editor.
USE database_name;
GO
SELECT SCHEMA_NAME(schema_id) AS schema_name,name AS table_name
FROM sys.tables
WHERE OBJECTPROPERTY(OBJECT_ID,'IsIndexed') = 0
ORDER BY schema_name, table_name;
GO
Thursday, July 7, 2011
Server Side Paging
In the previous post I wrote about OFFSET and FETCH on SQL Denali.
Today I want to write a sample to use them in a real world:
Normally to do paging on server we do this:
which simply by changing @DesiredPageNumber, we can display data from different pages, but using OFFSET and FETCH in SQL-#Denali make it really simpler:
as you can see it's really simpler and makes the developer's life much easier and has better has better Performance too.
reference
Today I want to write a sample to use them in a real world:
Normally to do paging on server we do this:
USE AdventureWorks
GO
DECLARE @NumberOfRows INT = 10 -- Number of rows you want on a page
DECLARE @DesiredPageNumber INT = 5 -- Page number
SELECT *
FROM
(
SELECT RowNum = ROW_NUMBER() OVER (
ORDER BY EmployeeID), *
FROM HumanResources.Employee
) AS a
WHERE RowNum > (@NumberOfRows * (@DesiredPageNumber - 1))
AND RowNum <= (@NumberOfRows * (@DesiredPageNumber - 1)) + @NumberOfRows
ORDER BY EmployeeID
which simply by changing @DesiredPageNumber, we can display data from different pages, but using OFFSET and FETCH in SQL-#Denali make it really simpler:
USE AdventureWorks
GO
DECLARE @NumberOfRows INT = 10 -- Number of rows you want on a page
DECLARE @DesiredPageNumber INT = 5 -- Page number
SELECT *
FROM HumanResources.Employee
ORDER BY EmployeeID
OFFSET (@NumberOfRows * (@DesiredPageNumber - 1)) ROWS
FETCH NEXT @NumberOfRows ROWS ONLY;
GO
as you can see it's really simpler and makes the developer's life much easier and has better has better Performance too.
reference
Subscribe to:
Posts (Atom)