I have a column called EventLog varchar(max) and can be pretty big because essentially it stores the event log of an entire batch process.

The problem is that when I go into the query window and do a select like this

SELECT EventLog from BatchProcess

When I cut and paste the text of the event log into Notepad, it

  1. removes all of the NewLines \n and is just one continous line.
  2. only copies a certain amount of text into the clipboard and truncates the rest.

How can I get the content of EventLog from the SQL Server Management Studio?

link|improve this question

59% accept rate
@Jim : u serious? SQL Server is an integral development tool for .NET development. I would've thought it'd be more suited here. – RoboShop Jun 10 '11 at 15:53
Your question is about how to interact with the UI, not about designing or writing code. – Ex Umbris Jun 10 '11 at 15:58
4  
yeah sorry i still don't agree with you. I think part of learning to develop software is learning how to use the development tools. Plus there's already 1000s of questions here that hasn't been closed about specific aspects of the software development tools – RoboShop Jun 10 '11 at 16:10
2  
@Jim I'm sure the same argument could be made for anything with the [visual-stuido] or [eclipse] or [ssms] tags. For example this recent question. Are all of these questions also off-topic? – Conrad Frix Jun 10 '11 at 16:33
2  
show 1 more comment
feedback

migrated from stackoverflow.com Jun 10 '11 at 18:18

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 3 down vote accepted

To deal with the truncation try converting it to XML for processing

DECLARE @S varchar(max)

SELECT @S = ''

SELECT @S = @S + '
' + EventLog  FROM BatchProcess

SELECT @S AS [processing-instruction(x)] FOR XML PATH('')

Code modifed from Martin's Smith's answer to How do I view the full content of a text or varchar(MAX) column in SQL Server 2008 Management Studio?

This may also solve the line breaks, but if its a big deal try a different editor

link|improve this answer
thank you, this is perfect for my need. I had a look at the log file, it was about 3MB, so I have a feeling SQL Server cuts off anything after one meg. – RoboShop Jun 11 '11 at 1:27
feedback
  1. removes all of the NewLines and is just one continous line.

That sounds like the typical crappiness of Notepad. IIRC, in order to actually display line breaks, Notepad needs \r\n line endings, not just \n. Try pasting into WordPad or a real editor.

link|improve this answer
it could've been but i tried it in Word and WordPad also, and it was still continuous lines. The other solution worked though, both for getting the data out and getting the NewLines to appear. – RoboShop Jun 11 '11 at 1:25
thanks for remind me :) – RoboShop Jun 11 '11 at 5:56
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.