The
4 and the
2 aren't relevant to the cast function, the
4 is related to the
varchar() and states that the string we're converting is 4 characters long
(2011). The
2 is related to the
right() and basically it says of the string we've just converted to varchar we just want to return the 2 right most characters
(11).
Brief details of each function;
RIGHT({String},{Number of characters})
{String} = CAST({Field to be Converted} as {Data Type to Convert To})
{Field to be Converted} = YEAR({datefield to extract year from})
{Data Type to Convert To} = VARCHAR({String Length})
{Number of characters} is the 2
{String Length} is the 4
{datefield to extract year from} is your {?dateparameter} field
Hopefully that clears up how it works, if you need any more assistance let me know.
Regards,
Ryan.
Edited by rkrowland - 03 Feb 2012 at 1:04am