Azure Data Studio – Extension – “sqlops-spexecutesql-to-sql”

Background

Reviewing a few SQL Statements and noticed some of them came across as prepared statements.

Wanted to see if I will be able to understand them by converting them to plain generic SQL.

SQL

Sample SQL

Here is a sample SQL


 sp_executesql
       N'select *
        from WideWorldImporters.Application.Countries
        where CountryName =  @_msparam_0'

     , N'@_msparam_0 varchar(4000)'

     , @_msparam_0=N'Brazil'

Traditional SQL

Here is a hand crafted comversion


declare @_msparam_0 varchar(4000)

set @_msparam_0=N'Brazil'

select * 

from WideWorldImporters.Application.Countries 

where CountryName =  @_msparam_0

Azure Data Studio

Extension

I know there is an extension for that….

PejmanNik/sqlops-spexecutesql-to-sql

Outline

  1. Launch Azure Data Studio
  2. Access Extensions panel
  3. Review list of extensions
    • Settled on sp_executesqltosql => Convert sp_executetosql => Pejman Nikram
  4. Click on Install
  5. GitHub
  6. Add Extension Azure Data Studio
    • Returned back to Azure Data Studio
    • Accessed menu option ( File \ Install Extension from VSIX Package )
    • In the Open File Dialog pointed towards the folder where I saved the file
  7. Refreshed Extensions
  8. Attempt Conversion
    • Launched new query window
    • Pasted SQL that contains sp_executesql
    • Access extension menu by invoking Help Key ( F1 )
    • Enter convert into window
    • Chose sp_executesql to sql: convert
  9. No magical conversion
  10. Current Version
    • Noticed that the version installed is 0.0.1
    • Revisited GitHub
    • Awared Downloaded v 1.0.0 is available
  11. Downloaded latest version
  12. Installed via previous path
  13. Review Extensions Version
  14. **** Nothing ****

Images

List of Extensions

listofExtensions.01.20190824.0738PM

Access Extensions

access.help.F1.convert

Enabled Extensions

versioning.01.20190824.0803PM.PNG

Bugs Filled

  1. GitHub
    • Azure Data Studio
      • Extension “sp_executesql to SQL” is not working

Summary

I don’t think I am home yet.

BTW, v1.0 was released on June 30th, 2019.

References

  1. Pejman Nik
    • GitHub
      Link
    • GitHub – PejmanNik/sqlops-spexecutesql-to-sql
      Link

One thought on “Azure Data Studio – Extension – “sqlops-spexecutesql-to-sql”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s