With SQL Complete, you can copy data from a cell or an entire table in the results grid to clipboard or to a CSV, XML, HTML, or JSON file.
To copy data from the results grid, select the values you want to copy, right-click them and select Copy Data As > file format (CSV, XML, HTML, or JSON) > To File or To Clipboard.
Alternatively, you can use shortcuts to copy data to the clipboard for a specific file format:
If you want to copy column names from the grid, select the columns you want to copy, right-click and select Copy Data As > Copy Column Names Only or press Ctrl+Alt+Y,N.
If you want to copy column names and types of their values from the grid, select the columns you want to copy, right-click and select Copy Data As > Copy Column Names and Types or press Ctrl+Alt+Y,T.
Let’s take the CSV format as an example and see how SQL Complete copies data to clipboard.
The output is as follows:
680,FR-R92B-58,Black,375,"1,431.50"
706,FR-R92R-58,Red,375,"1,431.50"
707,HL-U509-R,Red,3,34.99
708,HL-U509,Black,3,34.99
709,SO-B909-M,White,3,9.50
In the example provided above, you may notice that the data in the last column is exported without a trailing separator. This can lead to issues when the data is imported into a CSV file. To resolve this, we recommend adding an empty column when querying data. This will add the required separator when you copy the data from the grid with that empty column.
To export data with an additional empty column, first generate an output containing this empty column using a SELECT query.
You can achieve by adding a pair of single quotation marks (‘’) in place of a column name in your query. For example:
SELECT ProductID, ProductNumber, '', Color, ReorderPoint, ListPrice
FROM Production.Product
WHERE Color IS NOT NULL AND ListPrice !=0
Then, select the fields you want to copy, right-click them, and select Copy Data As > CSV > To File or To Clipboard.
Then, paste the data. The output should be as follows:
FR-R92B-58,
FR-R92R-58,
HL-U509-R,
HL-U509,
SO-B909-M,
1. In the SQL Complete menu, select Options.
2. In the SQL Complete: Options dialog, switch to Data Export > CSV and configure data export to the CSV file format.
Option | Description |
---|---|
Use Unicode | Creates a .csv file with a Unicode character encoding. |
Show a table header | Indicates whether to write column headers. |
Quote string | Encloses a string in quotes. The recommended options are single quote mark or double quote mark. |
Force quote | Indicates whether quoting should be optional (if cleared) or added at all times (if selected). |
Field separator | Defines a field separator by using one of the available options: comma, semicolon, Tab, or Space. |
3. To save changes, click OK.
Note
For more information on configuring data export options, see Data Export.
After you have copied data, you can easily paste it into any editor, such as Google Sheets, Microsoft Excel, LibreOffice Calc, and so on. To do this, you can press CTRL + V in the editor where you want to insert it or select the required option. Since the option name may vary among editors, feel free to refer to their official documentation.
You can also paste the copied data from the clipboard, for example, into Notepad, and then save it as a separate file with the .csv extension.