Partition By Function In Sql Server