Tuesday, May 26, 2015

SSRS Page Break After X Number of Records

In SQL Server Reporting Services you can add a page break after a desired amount of records.
Step 1: A simple design to show all rows in a table using table component.

Step 2: Add a group to the detail row

Step 3: Add group expression “=Ceiling((RowNumber(Nothing)) / Nth row)” and Click OK


Step 4: You may get the following error if you run the report after step 3.

Step 5: Open Row group properties  and remove sort expression.




Step 6:  Now, report will show 30 rows in a group. Next step is to define page break for the group. Go to page breaks tab and select page break option


Step 7: Now, hide the group header and detail column from the table component and run the report.



I hope this article will be very helpful to all. Thanks for reading this article.

“Keep reading and share the knowledge”  
“Grow more trees to save the Earth”

Attach DB without log file(.ldf) in SQL Server

The following article is to create the Database into SQL Server instance without .ldf file. 
There are 2 files required to create database in SQL Server instance


1 .mdf is the primary database file where all table ,view,indexes , SP etc.. stored.
2 .ldf is the transaction log file where all transaction logs are stored since last backup.

we may end up situation where we have only .mdf file to attach. in this case we can create .ldf when we creating the primary database file (.mdf) into the database.

the following query will create the .mdf file and create .ldf file in the database.


CREATE DATABASE <DB Name>
ON (FILENAME = 'Physical path of .mdf file')
FOR ATTACH_REBUILD_LOG  

I hope this article will be very helpful to all. Thanks for reading this article.

“Keep reading and share the knowledge”  
“Grow more trees to save the Earth”