Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I use Identity_Insert on a table from a dbase located on an entirely different server?

Posted on 2008-09-30
3
Medium Priority
?
324 Views
Last Modified: 2012-05-05
I am working on developing DNN modules for my company intranet to replace the need for Access to perform certain functions. My intranet is located on 1 server which is seperate from my main SQL server. I developed all the stored procedures with a copy of the live database which I placed on the same server I was developing the modules. I got everything working perfectly, but then once I pointed the path for all procedures to the live database I get an error on the 2 insert procedures which require an Identity_Insert statement. To get the path to work on SQL I had to place brackets around the server and database name to treat it as a single argument since it seems Identity insert will only allow 3 arguments ->[UCLISERVER1.Engineering01].dbo.Activity. However, now that everything is hitting the live database I get the error {Cannot find the object "UCLISERVER1.Engineering01.dbo.Activity" because it does not exist or you do not have permissions.} when I try to run the code that calls the insert procedure. If I rem out the Identity_insert lines I just get the generic error telling me I need them. Does anybody know how to get around this?
0
Comment
Question by:casper114
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
aaronakin earned 1000 total points
ID: 22607375
1. Then you put brackets around UCLISERVER1.Engineering01, you are essentially telling SQL Server that "UCLISERVER1.Engineering01" is your database name.  To specify it as a server & database, you'd have to use "[UCLISERVER1].[Engineering01]".

2. You can use IDENTITY_INSERT for a remote server.  This is why it only allows a 3-part name.  You'll probably have to call an SP on the live server to do the insert in order to make this work.
0
 

Author Comment

by:casper114
ID: 22609229
Thanks Aaron. Created insert SP's under the live database and once I changed the call to those procedures everything worked great. I'll have to remember that when using the Identity_Insert in the future.
0
 

Author Closing Comment

by:casper114
ID: 31501624
Thanks for your help. Once I was able to sit down and implement it, things went beautifully.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question