Tuesday, January 31, 2006

How to get the current server date and time inside a User Defined Function on SQL Server

User Defined Function cannot contain calls to non-deterministic functions, so a call to GETDATE() cannot be executed inside a function.
 
To get the current time and date, this is usually good enough:
 
SELECT MAX(last_batch)  FROM master.dbo.sysprocesses

Friday, January 20, 2006

Alternating Row Background Colors in Reporting Services

By default the BackgroundColor property of the row is "Transparent." To alternate colors, change to an Expression like this one:

=IIF(RowNumber(Nothing) Mod 2,"Transparent","LightGray")