https://github.com/wichopy/mssql-server-docker-vscode-macos
Some practice code to experiment with ms sql on MacOS in a VS code + Docker environment
https://github.com/wichopy/mssql-server-docker-vscode-macos
Last synced: 6 months ago
JSON representation
Some practice code to experiment with ms sql on MacOS in a VS code + Docker environment
- Host: GitHub
- URL: https://github.com/wichopy/mssql-server-docker-vscode-macos
- Owner: wichopy
- Created: 2018-07-15T00:04:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-15T03:01:38.000Z (almost 8 years ago)
- Last Synced: 2025-01-22T01:47:02.411Z (over 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microsoft SQL Server + Docker + VS Code + MacOS
This repo is a reference for connecting to and developing with MS SQL Server in a MacOS / VS Code / Docker environment.
## Run Image
From the Microsoft docs:
https://docs.microsoft.com/en-ca/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017
`docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=[YOUR_STRONG_PASSWORD] -e MSSQL_PID=Express -p 1433:1433 --name [YOUR_CONTAINER_NAME] microsoft/mssql-server-linux`
## Connect to database using docker + bash:
`docker exec -it [YOUR_CONTAINER_NAME] bash`
`/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '[YOUR_STRONG_PASSWORD]'`
## VS Code mssql extension:
From the Microsoft docs:
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode?view=sql-server-linux-2017
Create a new profile cmd + shift + P > MS SQL: Connect
Follow prompts for database configurations
Open script file and hit cmd + shift + E to execute a query.
Have the option to right click on results and save queries as json
## Sample Scripts
This repo contains some very basic scripts to create a data base, create a table, insert into a table, and select from a table.
Try executing scripts from the docker bash and within VS Code using the mssql extension.
Important: Each script needs to start with a USE [TABLE_NAME] for the script to execute.