question

Katie 1 avatar image
Katie 1 asked

ident_current on linked server

hi, i am trying to implement the follwoing from server A to a linked server B DECLARE @IDENT_GEN INT = (SELECT IDENT_CURRENT ('linkedservername.[database].[schema].[tablename]')) select @IDENT_GEN INT Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "server.tablename.schema.tablename" could not be bound. How can i achieve this?
sql-server-2008tsql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
JohnM avatar image
JohnM answered
Someone feel free to correct me, but I don't believe that you can call IDENT_CURRENT across a linked server. The scope for that function is for the current session for the server on which it was executed. http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/a100b316-c093-4133-8694-90ae862f9c22/ The above link provides a possible solution or you can also create a stored procedure on the remote server to determine the next value. Your query can then execute the remote stored procedure and the results will be returned to the current session. Hope this helps!!
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.