0

I am amateur in SQL Server jobs or procedures and i need to develop a job to copy data from a database to another one. if you know a little example that can help me to create it, i will really thankfull.

It should be like a function, that someones call the function (by the name) and it automatically copy data from a database to another one.

Luis Quijada
  • 3
  • 1
  • 5
  • 1
    1) https://learn.microsoft.com/en-us/sql/relational-databases/tables/copy-columns-from-one-table-to-another-database-engine?view=sql-server-ver15 2) https://stackoverflow.com/questions/13237623/copy-data-into-another-table 3) https://www.sqlshack.com/how-to-copy-tables-from-one-database-to-another-in-sql-server/ – Luuk Aug 07 '20 at 15:35
  • or, in words, use the "SQL Server Export/Import wizard" – Luuk Aug 07 '20 at 15:36
  • Is this a direct copy or do you want to perform a few modifications before copying the data to new server? – Sowmyadhar Gourishetty Aug 07 '20 at 15:43
  • Is a direct copy, monthly i need to call to the SQL Server job, to copy data from a DB to the another. – Luis Quijada Aug 07 '20 at 18:12

1 Answers1

0
  1. Expand the SQL Server Agent node and right click the Jobs node in SQL Server Agent and select 'New Job'

  2. In the 'New Job' window enter the name of the job and a description on the 'General' tab.

  3. Select 'Steps' on the left hand side of the window and click 'New' at the bottom.

  4. In the 'Steps' window enter a step name and select the database you want the query to run against.

  5. Paste in the T-SQL command you want to run into the Command window and click 'OK'.

    INSERT INTO newTable
    SELECT * FROM oldTable
  1. Click on the 'Schedule' menu on the left of the New Job window and enter the schedule information (e.g. daily and a time).

  2. Click 'OK' - and that should be it.

Check the animated gif by S.Mason

enter image description here