SQL SERVER – DMV – For finding the Page count, index level, record count of an Index

This is a small post for finding the page count, index level and record count of an index. This script will definitely help you in Performance Tuning projects.

 

select i.name,i.type_desc,s.page_count,s.record_count,s.index_level from
sys.indexes i
inner join sys.dm_db_index_physical_stats(DB_ID(N'DatabaseName'),
object_id(N'TableName'),null,null,'Detailed')as s
on i.index_id = s.index_id
where i.object_id = object_id(N'dbo.TableName')

Posted in DMV, index level, record count of an Index, SQL SERVER - DMV - For finding the Page count | Leave a comment

SQL Server – Importance of Coding standards – FIX – Msg 15225, Level 11, State 1, Procedure sp_rename, Line 338 No item by the name of could be found in the current database, given that @itemtype was input as ‘(null)’.

Mostly we all know that sp_rename is a system stored procedure, which is used to rename an object in the sql server database. But I recently entered into the scenario where this stored procedure doesn’t work properly due to bad coding standards.

We can just look at this scenario,

I renamed a table “Bankloan” to “dbo.Bankloan” using sp_rename. But when I tried to rename it back to “dbo.Bankloan” to “Bankloan”, it throws the error.

After this I tried re-naming the column by putting tablename inside the square brackets and it worked fine. This post is just to make us to remember the Importance of the coding standards in the SQL Server.

 

Posted in SQL Errors, SQL Server – Importance of Coding standards - FIX - Msg 15225 | Leave a comment

SQL Server – Business Intelligence Overview- OLTP vs. OLAP

Online Transactional Processing (OLTP) refers to day to day operations. Whereas OLAP refers to Managerial operations.  OLTP is application oriented, OLAP is subject oriented.

A BI system is a solution for gathering the operational data or external source of data and transforming it to a consistent form  and stored in a single location and presenting the information  for analysis and decision making.

Microsoft SQL Server gives all the scalability of Business Intelligence. Just look at this picture,

Posted in Business Intelligence, SQL Server – Business Intelligence Overview- OLTP vs. OLAP | Leave a comment