Author Topic: How to find no of page of table in sql server  (Read 2826 times)

kaluahir16

  • Newbie
  • *
  • Posts: 20
    • View Profile
How to find no of page of table in sql server
« on: October 04, 2012, 02:52:40 PM »
We can use following formula for it :

No. of Pages = ((Column1 size + Column2 size+ Column3 size ...) * No. of row) / 4096

Try following query to find no. of page
Code: [Select]
Create table Company
(
Name varchar (50),
Address Varchar(100),
Description Varchar(8000)
)

Insert into Company
select 'Abc','Ahmedabad','test'
Union
select 'qwe','Ahmedabad','test'
Union
select 'poi','Ahmedabad','test'
Union
select 'xyz','Ahmedabad','test'

select ((50 + 100 + 8000) * 3) / 4096  as [No. of page]

« Last Edit: October 04, 2012, 02:59:29 PM by BhushanShah »
Regards,
Kalu Bhuva

BhushanShah

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 73
  • BhushanShah21
    • View Profile
Re: How to find no of page of table in sql server
« Reply #1 on: October 04, 2012, 03:12:16 PM »
In case of varchar(max) what will be column's size?

Regards,
Bhushan Shah
Regards,
Bhushan Shah

Ritesh Shah

  • Administrator
  • Jr. Member
  • *****
  • Posts: 57
  • Ritesh Shah
    • View Profile
    • IT Technology Blog
Re: How to find no of page of table in sql server
« Reply #2 on: October 05, 2012, 09:14:00 AM »
Hi Bhushan,

I guess Kalu has explained the concept of SQL Server Compact edition as SQL Server regular edition used to have 8KB pages. In SQL Compact edition, there is no concept of Varchar(MAX) datatype I think.
Ritesh Shah
Administrator
Extreme-Advice.com
SQLHub.com