How do I copy SQL Azure database to my local development server?

后端 未结 22 1139
抹茶落季
抹茶落季 2020-11-28 01:06

Does anyone know how I can copy a SQL Azure database to my development machine? I\'d like to stop paying to have a development database in the cloud, but it\'s the best way

22条回答
  •  攒了一身酷
    2020-11-28 01:42

    The trick for me was to start replicating PKs/FKs/constraints on empty DB, then temporarily disable constraints while importing data (see https://stackoverflow.com/a/161410).

    More precisely:

    1. Create empty target DB manually;
    2. Right-click source DB > Tasks > Generate Scripts;
    3. Run script file on empty target DB (now DB has correct PKs/FKs/constraints, but no data);
    4. Disable all constraints;
    5. Import data (Right-click target DB > Tasks > Import Data);
    6. Re-enable constraints.

    Hope this helps!

提交回复
热议问题