diff --git a/SQLExpress/README.md b/SQLExpress/README.md new file mode 100644 index 0000000..70b9c54 --- /dev/null +++ b/SQLExpress/README.md @@ -0,0 +1,58 @@ +# SQL Express - LocalDB Setup + +- Download free specialized Version [SQL EXpress 2022](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) bootsrapper installer +- Launch the bootstrap. Select Custom installation +- Under installation, select `New SQL Server standalone installation` + - Uncheck `Azure Extension for SQL Server` + - Uncheck `Database Engine Services` + - Check `LocalDB` + + ## Setup a database + + - Under Command prompt + +```sh + // Show localdb instances +$ sqllocaldb info + + Create a new localdb instance +$ sqllocaldb create myLocalDB + + // Check created instance +$ sqllocaldb info myLocalDB +Name: myLocalDB +Version: 16.0.1000.6 +Shared name: +Owner: R9-5900X\yikth +Auto-create: No +State: Stopped +Last start time: 5/10/2023 9:16:58 pm + + // To start instance +$ sqllocaldb start myLocalDB +Name: myLocalDB +Version: 16.0.1000.6 +Shared name: +Owner: R9-5900X\yikth +Auto-create: No +State: Running +Last start time: 5/10/2023 9:18:37 pm +Instance pipe name: np:\\.\pipe\LOCALDB#6B6829ED\tsql\query +``` + +## SSMS Management Tool +- From SQL Server Installation Center, select `Install SQL Server Management Tools`. Latest version time of writing : v19.1 +- Launch SSMS +- To connect to newly create localdb instance, enter `(localdb)\myLocalDB` into server name. Use `Window Authentication` +- Click `Connect` +- Upon Connected, right click on `Database` to create a new database eg.: `myDatabase` + +## Migrate mdb to localdb +- Right click on the `myDatabase`, select `Tasks` > `Import Data` +- A wizard will launch +- For source, select `Microsoft Access Jet Engine`. Select the mdb file +- For target, select `Microsft OLE DB Provider for SQL Server` +- Set server name using the above pipe name `np:\\.\pipe\LOCALDB#6B6829ED\tsql\query` +- Click `Next` +- Select list if table to import +- On SSMS, right click and select `Refresh` database. Under `Tables`, the imported table will be shown