Showing posts with label book. Show all posts
Showing posts with label book. Show all posts

Saturday, February 25, 2012

Data and index pages

As found in a book saying about Index pages:
'Unlike data pages, there is no limit to the total number of entries that
can be made on an index page.'
What is that mean ?
It's wrong. An index page has the exact same limit as a data page. There's
8k in a page minus the header size and the slot array and that's all the
space that available on the page for records (entries). There's a finite
limit defined using the minimum possible record size plus the slot array
overhead for each record - I'd work it out for you exactly but I can't
remember the minimum possible record size off the top of my head. The max is
somewhere around 310-320 records per page though.
Regards
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alan" <NOSPAMalan_pltse@.yahoo.com.au> wrote in message
news:uXr6ainqEHA.1644@.tk2msftngp13.phx.gbl...
> As found in a book saying about Index pages:
> 'Unlike data pages, there is no limit to the total number of entries that
> can be made on an index page.'
> What is that mean ?
>

Data and index pages

As found in a book saying about Index pages:
'Unlike data pages, there is no limit to the total number of entries that
can be made on an index page.'
What is that mean ?It's wrong. An index page has the exact same limit as a data page. There's
8k in a page minus the header size and the slot array and that's all the
space that available on the page for records (entries). There's a finite
limit defined using the minimum possible record size plus the slot array
overhead for each record - I'd work it out for you exactly but I can't
remember the minimum possible record size off the top of my head. The max is
somewhere around 310-320 records per page though.
Regards
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alan" <NOSPAMalan_pltse@.yahoo.com.au> wrote in message
news:uXr6ainqEHA.1644@.tk2msftngp13.phx.gbl...
> As found in a book saying about Index pages:
> 'Unlike data pages, there is no limit to the total number of entries that
> can be made on an index page.'
> What is that mean ?
>

data acess class

hi
i was reading book about asp.net and i found example for a dataacess class but i didn't understand this part

Private m_FieldData As New NameObjectCollection
Private _m_ConnectionString As String
Private m_dbConnection As SqlConnection
Private Sub AddParameters( _
ByVal objCommand As SqlCommand, _
ByVal objValues() As Object)

Dim objValue As Object
Dim I As Integer
Dim objParameter As SqlParameter

objCommand.Parameters.Clear()
SqlCommandBuilder.DeriveParameters(objCommand)

I = 0
For Each objParameter In objCommand.Parameters
If objParameter.Direction = ParameterDirection.Input _
Or objParameter.Direction = _
ParameterDirection.InputOutput Then

objValue = objValues(I)
objParameter.Value = objValue
I = I + 1
End If
Next
End Sub

Private Sub AddFieldParameters _
(ByVal objCommand As SqlCommand)

Dim objParameter As SqlParameter

objCommand.Parameters.Clear()
SqlCommandBuilder.DeriveParameters(objCommand)

For Each objParameter In objCommand.Parameters
objParameter.Value = _
_FieldData.Item(objParameter.ParameterName. _
Substring(1))
Next
End Sub
Public Function ExecDataReader _
(ByVal strStoredProc As String, _
ByVal ParamArray objValues() As Object) _
As SqlDataReader

Dim objCommand As SqlCommand
Dim objReader As SqlDataReader

objCommand = New SqlCommand

objCommand.CommandText = strStoredProc
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Connection = dbConnection

Try
objCommand.Connection.Open()
If (objValues.Length = 0) Then
AddFieldParameters(objCommand)
Else
AddParameters(objCommand, objValues)
End If
objReader = objCommand. _
ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As Exception
If objCommand.Connection.State.Open Then
objCommand.Connection.Close()
End If
End Try

Return objReader
End Function
can anybody help me what the author want to doTamer, can you be more specific?

Thanks|||hi i don't understand sub AddParameters and addfieldparameter
and why to add values as an array
and the parameter have only one single value why to pass an array of object i can pass a single value hope u understand me|||I'm going to have to kind of guess here as I don't know the source or the context of the script. That being said

Looking at just the AddFieldParameters sub:
---------------------------------
Private Sub AddFieldParameters (ByVal objCommand As SqlCommand)

Dim objParameter As SqlParameter

objCommand.Parameters.Clear()
SqlCommandBuilder.DeriveParameters(objCommand)

For Each objParameter In objCommand.Parameters
objParameter.Value = FieldData.Item(objParameter.ParameterName.Substring(1))
Next
End Sub
---------------------------------

I read this as the SQL command is being passed into the sub as a value and that value can have multiple lines to it. The FieldData object is being created with each line of the SQL command as a different entry in the array.

The AddParameters looks pretty much the same.

Does this answer your question?

I can look into this further if you provide me with the origional source and location of the script.

Thanks