Peter Petrov’s Weblog

var me = from practice in programming where practice.IsBestPractice && practice.UseLambda select practice.OptimalPerformance;

SCOPE_IDENTITY() vs @@IDENTITY – 1:0 September 19, 2008

Filed under: Note to self,SQL — ppetrov @ 4:55 pm
Tags: , ,

@@IDENTITY returns the most recently created identity for your current connection, not necessarily the identity for the recently added row in a table. Always use SCOPE_IDENTITY() to return the identity of the recently added row.

Advertisements
 

SQL Server 2008 Management Studio – Rename column & Intellisense August 8, 2008

Filed under: SQL — ppetrov @ 5:41 pm
Tags: , , ,

Yesterday when I have played around with SQL Server 2008 Management Studio(SSMS) RC0. I have spotted a bug and I have filed a bug report. The new SSMS has Intellisense but it isn’t invalidated when you rename a column. When we fire SSMS and write a simple query everything is correct.

When I rename the column from Name to RoomName the Intellisense isn’t updated.

As you can see the column name is RoomName but Intellisense still proposes Name.

The Query editor is also not refreshed as shown above.

It says “Invalid column name” when the it’s perfectly valid. Note that the parse command completed successfully (as expected). The query runs with no problems.

I hope it will be fixed in the final release.