I need a UDF (let's call it ISOyyyyww) which requires a datetime input and returns a varchar(6) consisting of the ISOyear(as yyyy) concatenated with the ISOweek (as ww) according to the ISO 8601 standard. In BOL is an example for the ISOweek, but that doesn't include the year.
should return : '200401'
should return: '200404'
should return: '199952'
I have made the function myself a while back, but it's monday morning and I can't remember where I put it and I don't want to make it again ;-)
If the solution works with every @@DATEFIRST setting it would be great!