tsql - How to create a 'sanitized' copy of our SQL Server database? -


we're manufacturing company, , we've hired couple of data scientists patterns , correlation in our manufacturing data. want give them copy of our reporting database (sql 2014), must in 'sanitized' form. means table names converted 'table1', 'table2' etc., , column names in each table become 'column1', 'column2' etc. there 100 tables, having 30+ columns, , tables have 2b+ rows.

i know there hard way this. manually create each table, sanitized table name , column names, , use ssis bulk insert rows 1 table another. rather time consuming , tedious because of manual ssis column mapping required, , manual setup of each table.

i'm hoping has done before , has faster, more efficienct, way.

by way, 'sanitized' database have no indexes or foreign keys. also, may seem make sense why want this, agreed our director of manufacturing , data scientists, first round of analysis involve many rounds.

you want scrub data , objects, correct? here do.

  1. restore backup of db.
  2. drop objects not needed (indexes, constraints, stored procedures, views, functions, triggers, etc.)
  3. create table 2 columns, populate table, each row has orig table name , new table name
  4. write script iterates through table, roe row, , renames tables. better yet, put data excel, , create third column builds tsql want build, cut/paste , execute in ssms.
  5. repeat step 4, columns. best query sys.columns objects need, put excel, , build tsql
  6. repeat again other objects needed.

backip/restore quicker dabbling in ssis , data transfer.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -