Azure Data Studio - Import Wizard Fix - My Small Contribution

One of the features in Azure Data Studio is called the 'Import Wizard'. This feature allows you to quickly import a file and specify your data types and lengths without dealing with the complex SSIS data import process.




To find the 'Import Wizard', go to your 'Connections' tab and select your server and database, then right-click on the database and select 'Import Wizard'. 




After I selected my server, database, my file to import, and the new table name. I then went to the 'Table schema' drop down, and that is when I noticed the bug. My table schemas were missing! I double-checked again, selecting another database, then back to the database I was importing and still nothing. My 'Staging' schema was nowhere to be found.



Needless to say, I was a bit disappointed! So, I went to GitHub and found the code. It turns out that the code populating the drop-down was querying the 'master' database and not the database I selected.

This needs to be fixed. So I forked the code, downloaded it, and make a few adjustments. Checked it in, and with few suggestions from the owners of that code section, finally had the solution I needed to make it through code review.



The original line of code is in red above, and the new lines of code that replaced the original line are in green.

What the code is doing is taking the database drop-down value and adding it along with a period and brackets (in case there is a space in your database name) and adding it to the dynamic query.

Now when you select your database, you see all of the schemas for your database. Now my 'Staging' schema is in the list, and I can pick it and import my table.





Since I first discovered this Import Wizard Feature in Azure Data Studio, I have learned that this feature has been added to (SSMS) v17.3 and later. This bug is not an issue in SSMS from v17.9.1 and later. I was not able to test in v17.3.

If you want to download Azure Data Studio follow this link https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15

Comments