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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 ident_current() in linked server

Author  Topic 

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-07-29 : 08:42:11
Hi,
I want to find out the last inserted identity values in the server which I linked to my live server.

I tried.

select * from Link1.db1.dbo.test
I am getting result for this.

select ident_current('Link1.db.dbo.test').
But i am not getting for this.


Is there any possible solution for this?

Karthik

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-29 : 09:14:17
Hi

Refer
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/

Those functions cannot be applied to remote or linked servers.

To obtain an identity value on a different server, execute a stored procedure on that remote or linked server and have that stored procedure, which is executing in the context of the remote or linked server, gather the identity value and return it to the calling connection on the local server
-------------------------
R..
Go to Top of Page

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-07-29 : 09:22:17
quote:
Originally posted by rajdaksha

Hi

Refer
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/

-------------------------
R..



these things will work fine in a single server.

But my case is different.

Is there any way to fetch the last inserted vaalue of a table in the linked server,
there could be number of transactions could occur
per second.

Karthik
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-29 : 09:26:10
quote:
Originally posted by karthik_padbanaban

quote:
Originally posted by rajdaksha

Hi

Refer
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/

-------------------------
R..



these things will work fine in a single server.

But my case is different.

Is there any way to fetch the last inserted vaalue of a table in the linked server,
there could be number of transactions could occur
per second.

Karthik




Those functions cannot be applied to remote or linked servers.

To obtain an identity value on a different server, execute a stored procedure on that remote or linked server and have that stored procedure, which is executing in the context of the remote or linked server, gather the identity value and return it to the calling connection on the local server

-------------------------
R..
Go to Top of Page

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-07-29 : 09:29:49
thnks for your comments.

I will have this.

But is there any better option than this,?.

Karthik
Go to Top of Page
   

- Advertisement -