From 1b855dfa42decc44f20cb585a4d531996a0459b0 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Thu, 14 Nov 2024 09:02:00 +0100 Subject: [PATCH 1/3] Show how to extract an existing database --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 71223889..492634cd 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,17 @@ If you are using Visual Studio, to make files excluded from the package appear i Wildcards are supported for all nodes (`Content`, `None`, etc.). For example, ``. + +## Use an existing database + +If you want to initialize your project with objects from an existing database, you can do so with the following command: + +``` +sqlpackage /a:Extract /p:ExtractTarget=Flat /scs:"data source=.\SQLEXPRESS;initial catalog=Chinook;Trusted_Connection=true;encrypt=False" /tf:.\Tables +``` + +> Note: The /tf parameter is currently required, and must refer to an non-existing folder. + ## Item templates To create database objects you can use the following item templates: From b0b1093bc51bcbb68678f563f327eea7c85196af Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Fri, 15 Nov 2024 07:40:47 +0100 Subject: [PATCH 2/3] add link to docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 492634cd..c9246305 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,8 @@ sqlpackage /a:Extract /p:ExtractTarget=Flat /scs:"data source=.\SQLEXPRESS;initi > Note: The /tf parameter is currently required, and must refer to an non-existing folder. +You can read more about the `sqlpackage /a:Extract` command syntax [here](https://learn.microsoft.com/sql/tools/sqlpackage/sqlpackage-extract). + ## Item templates To create database objects you can use the following item templates: From 917adb10e63bd362f8d0663dfe1b0332257da846 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Mon, 18 Nov 2024 15:43:36 +0100 Subject: [PATCH 3/3] Respond to feedback --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9246305..500a6180 100644 --- a/README.md +++ b/README.md @@ -84,13 +84,19 @@ Wildcards are supported for all nodes (`Content`, `None`, etc.). For example, `< ## Use an existing database -If you want to initialize your project with objects from an existing database, you can do so with the following command: +If you want to initialize your project with scripted objects from an existing database, you can do so with the following command: + +``` +sqlpackage /Action:Extract /Properties:ExtractTarget=Flat /SourceConnectionString:"" /TargetFile: +``` + +For example: ``` sqlpackage /a:Extract /p:ExtractTarget=Flat /scs:"data source=.\SQLEXPRESS;initial catalog=Chinook;Trusted_Connection=true;encrypt=False" /tf:.\Tables ``` -> Note: The /tf parameter is currently required, and must refer to an non-existing folder. +> Note: The /tf parameter is currently required, and must refer to a non-existing folder. You can read more about the `sqlpackage /a:Extract` command syntax [here](https://learn.microsoft.com/sql/tools/sqlpackage/sqlpackage-extract).