Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
danielhai
Yak Posting Veteran
50 Posts |
Posted - 2003-06-12 : 15:03:36
|
| Hi, i'm doing an insert into a linked server, but when i go to retreive the @@IDENTITY value - it returns me a null? anyone run into this problem before? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-06-12 : 15:11:11
|
| @@IDENTITY doesn't work across linked servers. You'll need to do a select on the table to get the information.Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-06-12 : 16:23:02
|
| @@identity is only valid for your connection - action on a linked server acts on a different connection to the other server (obviously).You can executed an SP on that server which returns the identity or do the insert via dynamic sql executed on the other server and return @identity from the same batch (sp_executesql). Think that will work.You could even have a linked server defined on the remote server to access tables on your server and execute your code there and return the identity.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|