Syntax for storing query results from one server to another server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kbaisch
    New Member
    • Mar 2007
    • 19

    Syntax for storing query results from one server to another server

    Can someone help me?
    I'm executing a stored procedure that runs a query. That works fine.
    I need the syntax to tell the stored procedure to save it to another server in a folder. Any help would be much appreciated.

    Thanks in advance.
  • Purple
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Hi kbaisch,

    Can you post the stored procedure so we can see what you are doing

    Regards Purple

    Comment

    • kbaisch
      New Member
      • Mar 2007
      • 19

      #3
      this is the stored procedure I have to run the query on the deh05 server. Now i need to send this information to a folder in my deh02 server.


      /*
      Name: Testmovetofolde rs
      Description: Move queries to folders on deh02
      Author: Kim Baisch
      Modification Log:

      Description Date Changed By
      Created procedure 06/14/07
      */


      CREATE PROCEDURE .[Testmovetofolde rs] AS
      SELECT TOP 100 PERCENT dbo.Medicaid_cu r.Name_, dbo.Medicaid_cu r.Sex_, dbo.Medicaid_cu r.DOB_, dbo.Medicaid_cu r.Residence_,
      dbo.Medicaid_cu r.Case#_, dbo.Medicaid_cu r.Race_, dbo.Medicaid_cu r.Elg_, dbo.Medicaid_cu r.Sub_, dbo.Medicaid_cu r.EligBegin_,
      dbo.Medicaid_cu r.EligEnd_, dbo.Medicaid_cu r.SSN_, dbo.Medicaid_cu r.Stat_, dbo.Medicaid_cu r.EligMax_, dbo.Medicaid_cu r.CurMth_,
      dbo.Medicaid_cu r.TPLCode_
      FROM dbo.Medicaid_cu r INNER JOIN
      dbo.VIEW1_3TABL ES ON dbo.Medicaid_cu r.Residence_ = dbo.VIEW1_3TABL ES.MRCityState_ ID
      WHERE (dbo.VIEW1_3TAB LES.AreaName = N'ANMC BUSINESS OFFICE')
      GO

      Comment

      • Purple
        Recognized Expert Contributor
        • May 2007
        • 404

        #4
        Hi kbaisch,

        connect to your remote server and run the create procedure SQL statement as posted previously which will create the stored procedure.

        Post back if you need clarification

        Regards Purple

        Comment

        • kbaisch
          New Member
          • Mar 2007
          • 19

          #5
          I'm sorry, I'm not very good at explaining. I'll try again....

          I want to add more script to this procedure telling it to save this as a "certain file" ie, xls, doc, etc. and telling it where to save it on a server in a folder. I don't know how to write that. Can you help me with that?

          Thank you for your help.

          Comment

          • gpinetto
            New Member
            • Jun 2007
            • 13

            #6
            Hi I think you must use User-Define functions with clr integrations to do this

            Comment

            Working...