sql server - How to use BULK INSERT to move data between two tables? -


how use bulk insert move data between 2 tables? can't find tutorial examples. have 10 mln records move. sql server 2012 sp3. 1 time action. can't use cmdshell, can't use ssis. have move data in batches. going night job. "move" don't have delete records in source. target table exists already, don't have check constraints , no foreign keys.

it easy shift data 1 database another, long both located in same server (as wrote it).

as want use script , want copy records 1 table might use this:

insert targetdb.dbo.tablename(col1,col2,col3...)  select col1,col2, col3 ... sourcedb.dbo.tablename 

this copy rows here there.

in question not provide enough information, want use script. above script...

  • if have existing data should read merge
  • if target , soure not have same structure, can adapt select return set need insert
  • if not need copy rows, add where clause
  • if user took connect has not necessary rights ask admin. - question or comment - take, applied admin anyway...
  • if databases live in 2 different servers, might read linked server
  • and might read import , export, supported ssms...

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -