I have a query that returns a large 'ntext' result. I want to copy this over to a plain text editor (Notepad), but only a part gets copied over.
I tried increasing Query Options -> Results -> Text, but the max seems 8192, which is insufficient for me.
Any ideas on how this can be achieved?
I'm using SQL Server Management Studio 2008, if that matters.
TIA! Raj
The way I could get the entire data was using the option "Save Results as..." and then select TXT file, and then you can open it with a good editor like notepad++ , and you will have all the data.
Cheers =0)
try something like this:
--creates file on server
declare @cmd varchar(1000)
select @cmd = 'osql -U -P -S -Q"select * from yourtable" -o"c:\yourtextfile.txt" -w50000'
exec master..xp_cmdshell @cmd
or
--creates file on server
master..xp_cmdshell 'bcp your_table_or_view out c:\file.bcp -S -U -P -c '
or
--the limit of 8192 is per column, so split your column into multiple columns
--you will get a 1 character gap between these "columns" though
;WITH YourQuery AS
(
SELECT
col1
FROM ...
)
SELECT SUBSTRING(col1,1,8192), SUBSTRING(col1,8193,8192), SUBSTRING(col1,16385,8192) --...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With