MateuszC
MateuszC

Reputation: 499

Microsoft SQL Server Management Studio - query result as text

I have a database in Microsoft SQL Server and I am using Microsoft SQL Server Management Studio.

I have an option to insert the query result to the file, although the results of the query are not separated by any special signs.

It looks like this

select * from table_name

Output:

18 182 3386 NULL
18 790 12191 NULL

In File:

18          182         3386        NULL
18          790         12191       NULL

Is there any possibility to modify query so after every record it will put a special char, like this:

In File:

18;          182;         3386;        NULL;
18;          790;         12191;       NULL;

It will be easier then for me to copy this database to other programs.

Upvotes: 15

Views: 26813

Answers (3)

Mitchell Pillay
Mitchell Pillay

Reputation: 121

CTRL+T Then Execute , = Text Result
CTRL+D Then Execute , = Grid Result

Upvotes: 11

M.Ali
M.Ali

Reputation: 69504

Click here

Click here on your SSMS before you execute your query.

Upvotes: 41

Hart CO
Hart CO

Reputation: 34774

In SSMS:

Tools > Options > Query Results > Results To Text

Top option there is Output Format, can set a delimiter there.

Upvotes: 18

Related Questions