Looks fine.
>The reason I wanted this was because I wrote a routine that SCANs through a table, and if
>a record was appended, it forms an INSERT command & runs it. Problem is, unless
>IDENTITY_INSERT is ON, then an error reults. The above code would allow me to exclude the PK
>column from the INSERT command.
>
>However, the PK column isn't necessarily the same columnd as the Identity column. So, long
>story short - what I really needed was a way to determine the Identity column. I came up
>with this:
>
>
>SELECT Name AS Identity_Column
> FROM sys.identity_columns
> WHERE Object_Id = object_id(@Table_Name)
>
>
>See any reason why this would not work?
--sb--