# Microsoft SQL Server

You may deploy the ngSurvey DACPAC package found in the databases/ directory of your zip file using the sqlpackage command line or the SQL Server Management studio.&#x20;

Please note that all these steps require an existing database, it can be either empty or with a previous version of ngSurvey. If any pre-existing ngSurvey database is found all its data and structure will automatically be upgraded to match the current installation version.

{% hint style="warning" %}
This database installation is not required by default ngSurvey will automatically configure the database that is setup in the Connectionstring.
{% endhint %}

## Requirements

1. SQL Server 2016 or above / Express.
2. SQL Server Azure / AWS. **Works only using SQLPackage.exe.**
3. Database's user must have DBO access to the database.

### Command line

1. Download [SQLPackage.exe](https://docs.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-2017) from Microsoft's website.&#x20;
2. Run following command from Window's Powershell or console to deploy the ngSurvey database code to your SQL Server. Make sure to put the proper path location of the sqlpackage.exe and to replace the TargetConnectionString by your own database connection string. `sqlpackage.exe /Action:Publish /Sourcefile:ngsurveydb.dacpac /TargetConnectionString:"Server=tcp:yourdatabaseserver,1433;Initial Catalog=yourdatabase;Persist Security Info=False;User ID=youruser;Password=yourpassword;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ngsurvey.com/installation-setup/installation/database-backend/microsoft-sql-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
