You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
Markdown
59 lines
2.0 KiB
Markdown
|
2 years ago
|
# 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
|