user9436741
user9436741

Reputation:

How to create script table data in Azure Data Studio?

I've Help table in our Dev Database and I'm just wondering how I can create script table data so that I can easily copy all my Help table data and paste it in our QA database Help Table?

I've used Simple Data Scripter extension but the output script is not the same format like what we have for other tables so just wondering if there is a way I can get the same data script format like the other for my Help Table.

// This is the original format that we have. I want the Help table to look like this too
--- Inserting Help type ---
insert into [dbo].HelpType (Id, Name) values(1, 'Help');


//This is what it look when I use Simple Data Scripter extension

--- Inserting Help ---

insert [Help] ([Id],[Name],[ParentId],[Text],[CreatedDate],[UpdatedDate],[Types])
select 1,'Deep Dive into Workspace',NULL,NULL,'2021-03-05 17:24:53.0000000',NULL,1 UNION ALL

Upvotes: 3

Views: 5786

Answers (1)

Joseph  Xu
Joseph Xu

Reputation: 6043

You can install Database Administration Tool Extensions for Windows on Azure Data Studio, this extension provides The Generate Scripts Wizard feature.
enter image description here

  1. When installed this tool, you can right click on your database node.
    enter image description here

  2. Select the specific table for which we need the script. We can select multiple objects as well for scripting: enter image description here

  3. In the next page, you’ll find scripting options like:

  • Save to file
  • Save to Clipboard
  • Save to a new query window enter image description here
  1. Click on Advanced (4) and view advanced scripting options:
    enter image description here

  2. If you require to generate scripts for data only. We do not want object scripts in the generated script. For this requirement, make the following changes in the advanced scripting options:

  • Script defaults: False
  • Script extended properties: False
  • Type of data to script: Data only
  • Script check constraints: False
  • Script foreign keys: False
  • Script primary keys: False
  • Script Unique keys: False

It will generate script as follows format:

INSERT [dbo].[emp] ([id], [name], [age]) VALUES (1, N'John', 29)
INSERT [dbo].[emp] ([id], [name], [age]) VALUES (2, N'Tom', 28)
INSERT [dbo].[emp] ([id], [name], [age]) VALUES (3, N'Tiny', 26)

Upvotes: 5

Related Questions