Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Dataset Bulk Dump
Topic Summary: Is it possible to bulk dump records from a dataset to a text file.
Created On: 04/21/2015 02:37 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Leonard Amabile, on Wednesday, April 29, 2015 5:43 PM

Answer:
Phillip,

If you are using a SQL user, you have to specify the username and password within the connection string anyway. You can build the script on the fly but you will still need to specify the password within a variable. Your initial request did not mention that the filename is within the records. You can still do a separate query to get the file name so that you can rename the dump file after. Unfortunately, this is the only other viable option without having to interact with SQL Management Studio or other 3rd party application.

 04/21/2015 02:37 PM
User is offline View Users Profile Print this message

Author Icon
PhillipWilkie
Apprentice (20-49)

Posts: 29
Joined: 10/09/2014

Hi there,

 

I am extracting data from a SQL Server database. It is populating a dataset with 100K+ records.

At present I am looping through the records and writing them to a text file, resulting in a 14Mb file.

Is there a way to do a bulk dump of the dataset instead of looping through it?

Cheers



 Category Survey
AutoMate 7 version: 7.1.2
Windows version: Windows 2003
 04/23/2015 07:22 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Phillip,

Are you familiar with PowerShell? I have attached a PowerShell script that is referenced in the steps below.

Please edit the file and update the following lines:

$Database = "bpa10"
$Server = "lamabile\sqlexpress"
$User = "user"
$Password = "password"
$AttachmentPath = "C:\test\SQLData.csv"
$SqlQuery = "SELECT * FROM dbo.automateconstructs"

You will also need to update step 2 of the below task to reference the correct location of the .ps1 file. Once you have made the appropriate updates, the script will generate a .csv file with your SQL query results.

 Category Survey
AutoMate 7 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)





-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 04/23/2015 05:53 PM
User is offline View Users Profile Print this message

Author Icon
PhillipWilkie
Apprentice (20-49)

Posts: 29
Joined: 10/09/2014

Leonard

 

Thanks for the resposnse.

 

  1. I don't like as it requires the production database username and password to be in, what is essentially, a text file.
  2. I don't know what the filename is until it is retreived from the database.
is there another viable option?



 Category Survey
AutoMate 7 version: 7.1.2
Windows version: Windows 2003
 04/24/2015 06:27 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Answer Answer
Phillip,

If you are using a SQL user, you have to specify the username and password within the connection string anyway. You can build the script on the fly but you will still need to specify the password within a variable. Your initial request did not mention that the filename is within the records. You can still do a separate query to get the file name so that you can rename the dump file after. Unfortunately, this is the only other viable option without having to interact with SQL Management Studio or other 3rd party application.



 Category Survey
AutoMate 7 version:
Windows version:


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1629 guests browsing this forum, which makes a total of 1629 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog