Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: SP Updates From Seperate Server

    MERRY CHRISTMAS EVERYONE

    I need to update a table on our Test Server which is GCSQLTEST, with another table thats on our live server GCSQL. How would I go about doing that in a stored procedure??

    Code:
    CREATE PROCEDURE [InsertRevised_MainTable]
    AS 
    INSERT INTO dbo.RevisedMainTable
    	 ([IR Number], [Date], [I/RDocument], [Violation Type])
    SELECT [Incident Report No], [Date], [I/RDocument], TypeOfIncident	
      FROM 	  dbo.RevisedMainTable
     WHERE NOT EXISTS (SELECT * FROM dbo.RevisedMainTable
     WHERE [IR Number] = [IR Number])

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    The simplest method is to set up a Linked Server and use four part naming conventions. Check these two terms in BoL for more dets.

    If you are updating test from live then I really would consider something asynchronous though - perhaps a job that runs regularly and completes the task.

  3. #3
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Talking ah ok

    Thank you Pootle appreciate it

  4. #4
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    look at OPENQUERY and OPENROWSET, I've sometimes seen a 1000% increase in performance with using these as opposed to 4 part qualifier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •