Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the full resultset from SSMS

Tags:

How do you get back the full content of rows in SQL Server Management Studio?

If you use "results to grid" the data is encoded, so things like line breaks are lost. If you do "result to file" or "results to text" the text is limited to 8192 characters.

NOTE: I have the solution, but I am using SO to document this. If you have a better answer feel free to post it.

like image 874
javamonkey79 Avatar asked Jan 19 '12 16:01

javamonkey79


People also ask

How do I show the results in SQL Server?

If we just use Ctrl+R we can toggle between showing and hiding the results pane and therefore you can see more of the Editor section when you are using SQL Server Management Studio.

How do I transfer data from SSMS to excel?

Launch SSMS and connect to the required database. 2. In Object Explorer, go to the database that you want to export to Excel. Invoke the shortcut menu and go to Tasks > Export Data.

How do I find the number of rows in a resultset in SQL Server?

To number rows in a result set, you have to use an SQL window function called ROW_NUMBER() . This function assigns a sequential integer number to each result row. However, it can also be used to number records in different ways, such as by subsets.


1 Answers

I cast it to XML

select @variable_with_long_text  as [processing-instruction(x)] FOR XML PATH  

The processing-instruction bit is there to stop it entitising characters such as < to &lt;

like image 128
Martin Smith Avatar answered Sep 19 '22 19:09

Martin Smith