SELECT INTO Statements
You can use the SELECT INTO statement to export formatted data to a file.
Data Export with an SQL Query
The following query exports data into a file formatted in comma-separated values (CSV):
SELECT name, radius INTO [csv://\"tenten\".\"public\".solar.txt] FROM [\"tenten\".\"public\".solar] WHERE orbits = 'sun'You can specify other formats in the file URI. The possible delimiters are tab, semicolon, and comma with the default being a comma. The following example exports tab-separated values:
SELECT name, radius INTO [csv://\"tenten\".\"public\".solar.txt;delimiter=tab] FROM ["tenten"."public".solar] WHERE orbits = 'sun'
C#
String connectionString = "[email protected];Password=password;LoginURL=https://my.domain.1010data.com/prime-latest"; using (C1010Connection connection = new C1010Connection(connectionString)) { C1010Command cmd = new C1010Command("SELECT name, radius INTO [csv://\"tenten\".\"public\".solar.txt] FROM [\"tenten\".\"public\".solar] WHERE orbits = 'sun' ", connection); int rowsAffected = cmd.ExecuteNonQuery(); }
VB.NET
Dim connectionString As [String] = "[email protected];Password=password;LoginURL=https://my.domain.1010data.com/prime-latest" Using connection As New C1010Connection(connectionString) Dim cmd As New C1010Command("SELECT name, radius INTO [csv://\"tenten\".\"public\".solar.txt] FROM [\"tenten\".\"public\".solar] WHERE orbits = 'sun'", connection) Dim rowsAffected As Integer = cmd.ExecuteNonQuery() End UsingYou can specify other file formats in the URI. The following example exports tab-separated values:
C#
String connectionString = "[email protected];Password=password;LoginURL=https://my.domain.1010data.com/prime-latest"; using (C1010Connection connection = new C1010Connection(connectionString)) { C1010Command cmd = new C1010Command("SELECT * INTO [\"tenten\".\"public\".solar] IN [csv://filename=c:/\"tenten\".\"public\".solar.csv;delimiter=tab] FROM [\"tenten\".\"public\".solar] WHERE orbits = 'sun'", connection); int rowsAffected = cmd.ExecuteNonQuery(); }
VB.NET
Dim connectionString As [String] = "[email protected];Password=password;LoginURL=https://my.domain.1010data.com/prime-latest" Using connection As New C1010Connection(connectionString) Dim cmd As New C1010Command("SELECT * INTO [\"tenten\".\"public\".solar] IN [csv://filename=c:/\"tenten\".\"public\".solar.csv;delimiter=tab] FROM [\"tenten\".\"public\".solar] WHERE orbits = 'sun'", connection) Dim rowsAffected As Integer = cmd.ExecuteNonQuery() End Using