yiisoft/yii — pull request #840 by c-schmitz (2012-06-18 20:41:05+00:00)
Title: Fixes issue #98 (https://github.com/yiisoft/yii/issues/98)...

...along with the problem that no identity value is returned on certain occasions occasions (for example Active Record usage)
See http://www.yiiframework.com/forum/index.php/topic/24275-solved-sql-server-2008-returning-blank-lastinsertid/ for further discussion. Solution has been tested and is in live production for quite some time.