December 2011 archive

Using RAND() in user defined function

Ever wanted to use a random number in a TSQL UDF? And getting an error message like this: Msg 443, Level 16, State 1, Procedure RandomString, Line 22 Invalid use of a side-effecting operator ‘rand’ within a function. There’s a quick (and dirty) solution for this.

Continue reading