D J Horton Consulting Ltd

Personal reference to useful tips and tricks for SQL Server, SQL Server Reporting Services and Crystal Reports.

My alternative to scraps of paper lying about.

Wednesday, 16 March 2011

Display parameter Label field - SSRS

I was familiar with displaying a parameter's value field by using the expression:

But in many cases this value will be a key field and pointless to display. The 'Label' field is required and is obtained by simply changing the expression to:

Simple and obvious really!

Wednesday, 9 March 2011

Return a random row - SQL

Instead of using the RAND() function which I believe is not truly random since using the same seed value results in the same output:

Whereas, CHECKSUM(NEWID()) would work:

and can thus be used to return a random row:

SELECT TOP(1) School.SchoolNameFROM School