未加星标

An Introduction To Azure Data Studio

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二05 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

In this article, we will see some of the features of the newly introduced Azure Data Studio. This is a cross-platform, lightweight database tool for data professionals and developers who are using the Microsoft family of on-premises and cloud data platforms on windows, MacOS, and linux.

Azure Data Studio offers a modern editor experience, code snippets, source control integration, and an integrated terminal. We can say, this might be a full replacement for traditional SSMS (SQL Server Management Studio) in future .

Please download Azure Data Studio from this Link .

Connect and Query Azure Data Studio.


An Introduction To Azure Data Studio

Enter your server details. Here, I am connecting with my SQL Server 2017 instance. I am using my Windows Authentication to connect server .


An Introduction To Azure Data Studio

It will show all your database details. I have only one user-defined database in my SQL server. The other four are system databases.


An Introduction To Azure Data Studio

It will also show the database size details in a very attractive way.


An Introduction To Azure Data Studio

Using T-SQL Code Snippets in Azure Data Studio

One of the major advantages in Azure Data Studio is its T-SQL Code Snippets. It has many built-in Code Snippets available.

We can use T-SQL Code Snippet to Create a new Database. Please open a new SQL Query window ( Ctrl+N ) and type “ SQL ”


An Introduction To Azure Data Studio

Please select “ sqlCreateDatabase ” snippet and press Enter key.


An Introduction To Azure Data Studio
--Createanewdatabasecalled'DatabaseName' --Connecttothe'master'databasetorunthissnippet USEmaster GO --Createthenewdatabaseifitdoesnotexistalready IFNOTEXISTS( SELECT[name] FROMsys.databases WHERE[name]=N'DatabaseName' ) CREATEDATABASEDatabaseName GO

It will automatically fill the code snippets to the Query editor. You can give a valid name to the Database and execute the Query.


An Introduction To Azure Data Studio
--Createanewdatabasecalled'DatabaseName' --Connecttothe'master'databasetorunthissnippet USEmaster GO --Createthenewdatabaseifitdoesnotexistalready IFNOTEXISTS( SELECT[name] FROMsys.databases WHERE[name]=N'SarathDB' ) CREATEDATABASESarathDB GO

We can create our own T-SQL Code Snippets very easily. Please open Command Pallet ( Ctrl+Shift+P ) and type “snip”


An Introduction To Azure Data Studio

Choose SQL snippet. ( sql.json file)


An Introduction To Azure Data Studio

I have added two code snippets in this file. One is for selecting the top 100 records from any table, and the other is for creating a new table. You can add any number for code snippets in this file. Please note that we can define any number for parameters for each code snippet also.


An Introduction To Azure Data Studio
{"Selecttop100":{ "prefix":"sqlSelectTop100", "body":"SELECTTOP100*FROM${1:TableName}ORDERBY${2:ColumnName}", "description":"SelectTop100RecordsfromaTable" }, "CreateTablesnippet":{ "prefix":"sqlCreateTableSarath", "body":[ "--Createanewtablecalled'${1:TableName}'inschema'${2:SchemaName}'", "--Dropthetableifitalreadyexists", "IFOBJECT_ID('$2.$1','U')ISNOTNULL", "DROPTABLE$2.$1", "GO", "--Createthetableinthespecifiedschema", "CREATETABLE$2.$1", "(", "$1IdINTNOTNULLPRIMARYKEY,--primarykeycolumn", "Column1[NVARCHAR](50)NOTNULL,", "Column2[NVARCHAR](50)NOTNULL", "--specifymorecolumnshere", ");", "GO" ], "description":"Userdefinedsnippets:CreateanewTable" } }

We can check the new code snippets in Query editor window. Please type “ SQL ” again


An Introduction To Azure Data Studio

Please note the newly added two code snippets listed in Query editor. You can choose any of the new code snippets and press the Enter key. Our new code snippet will be loaded successfully.


An Introduction To Azure Data Studio
--Createanewtablecalled'TableName'inschema'SchemaName' --Dropthetableifitalreadyexists IFOBJECT_ID('SchemaName.TableName','U')ISNOTNULL DROPTABLESchemaName.TableName GO --Createthetableinthespecifiedschema CREATETABLESchemaName.TableName ( TableNameIdINTNOTNULLPRIMARYKEY,--primarykeycolumn Column1[NVARCHAR](50)NOTNULL, Column2[NVARCHAR](50)NOTNULL --specifymorecolumnshere ); GO

Adding new Extensions to Azure Data Studio

You can add more extensions easily by clicking the “Settings” icon and then clicking “Manage Extensions” button.


An Introduction To Azure Data Studio

SQL Server Import is one of the recommended extensions by Azure Data Studio.


An Introduction To Azure Data Studio

You can click the “Install” button.


An Introduction To Azure Data Studio

After some time, the new extension will be installed successfully.


An Introduction To Azure Data Studio

We can use this SQL Import tool to import data from CSV or JSON file to SQL database.

Please right-click the Database and choose “I

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

tags: SQL,Studio,code,Azure,Data,Please,new,snippets
分页:12
转载请注明
本文标题:An Introduction To Azure Data Studio
本站链接:https://www.codesec.net/view/604385.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(24)