Friday 30 August 2013

MSSQL - how to fix error Cannot assign a default value to a local variable.

Watch on Youtube



When executing code like

Declare @Test int  = 1

I am getting error
Cannot assign a default value to a local variable.

This is because I am using old version of MSSQL (9.5)
To fix it - download the newest version.

MSSQL How to load all records if search criteria is null

 Watch this example on Youtube


WHERE CustomerName = @cust_name OR @cust_name is NULL

Thursday 22 August 2013

Excel - How to calculate percentage difference between 2 cells



A1 = 232
B1 = 23
=(B1/A1)-1    then convert cell to percentage - will tell me how much more b needs to get to a
=(B1/A1)    then convert cell to percentage - will tell me b is what percentage of a

Thursday 8 August 2013

SSRS - Default Date Parameter and other formatting issues

First day of the month
=CDate(Format(DateSerial(Year(Now()), Month(Now()), 1),"dd/MM/yyyy"))

Today
=CDate(Format(now(),"dd/MM/yyyy"))

Format Currency ($ Dollar)
'$'#,0.00;('$'#,0.00)