With both @@IDENTITY and @@ROWCOUNT you have to be careful (whether using SPT or running an SP) if a trigger calls an SP that does something that modifies those variables, you will get a bad result.
BOb
>You asked for the BEST way.....
>
>The best way is to use a stored proc tha handle the insert..
>
>Here is a sample:
>
>
>CREATE PROCEDURE customers_add @Name Varchar(50),@newkey INTEGER OUTPUT
>
>AS
>
> BEGIN TRANSACTION
>
> INSERT INTO Customers(name)
> VALUES (@name)
> SELECT @newKey = @@IDENTITY
>
> COMMIT TRANSACTION
>
>
>
>This method of course assumes the use of identity columns...which should be used for primary keys any way. Does @@RowCount work? It appears to. However, if you are looking for the BEST way to handle this, why not reference an environmental variable that specfically deals with new records. If the insert fails, @@Identity evaluates to null. The use of output variables is an extremely effective technique for deterimining success and failure. And, you only need to make 1 call...
>
>
>>I would like to know the best way to verify if data inserted into a client/server table was committed. I establish a connection and verify the connection. Then, I intert data into the table. This all work fine, I just need to verify the insert.
>>
>>Thanks, Chris