Showing posts with label SQL Server 2012. Show all posts
Showing posts with label SQL Server 2012. Show all posts

Monday, July 9, 2012

Add Custom Code in SSRS

How to Add Custom Code in SSRS

1.       Create a new .rdl file open it
2.       Open the report and In the Design view, right-click the design surface outside the border of the report and click Report Properties.
3.       Click Code.
4.       In Custom code, type the code. Errors in the code produce warnings when the report runs. The following example creates a custom function named AddPrefix. (Code should be written in vb)
Public Function AddPrefix (ByVal s As String) As String 
Return “INV00” + s

End Function

5.       Use the below code to use this function in your report
=Code. AddPrefix(Fields!InvoiceCode.Value)

Sunday, July 8, 2012

SQL Server 2012 Build-In Functions


Function
AVG
Description
Calculates the average of the Values in a Group.
Syntax
AVG (<>)
Optional
ALL  OR DISTINCT keyword can be used before the <> to get Average based on all values or Distinct values
Example
Select AVG(Math_Marks) From StudentMarks Group By Sections


Function
COUNT
Description
Gives no of items in a group
Syntax
COUNT (<>/ *)
Optional
ALL  OR DISTINCT keyword can be used before the <> to get count of all values or Distinct values
Example
Select Count(Student) From StudentMarks Group By Sections

Increasing the Size of SQL Server 2012 DB

USE master;
GO
ALTER DATABASE TestDb
MODIFY FILE
    (NAME = testdbdat,
    SIZE = 50MB);
GO
This command will increase the database TestDb data file to 50MB.