Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSMS Copy and Paste Without Header

How do I copy and paste one record from SSMS 2012 without the header (when it comes along without me asking for it)? In SSMS, Tools -> Options -> Query Results -> SQL Server -> Results to Grid -> "Include column headers when copying or saving the results" is unchecked. Sometimes I would like to copy the header, however most of the time I would like to copy and paste one record into Excel and the header comes along uninvited - either when I do ctrl + C or just right click and "Copy". I've tried rebooting my computer to be sure it wasn't some sort of cached functionality but I can't seem to shake the header. Please help!

like image 320
user2313215 Avatar asked Nov 13 '13 21:11

user2313215


People also ask

How do I copy only column names in SQL Server?

Select cells from the columns you want to copy (CTRL+Click), choose "Copy selected Headers" in Results grid context menu and column names will be copied to clipboard.

How do I copy and paste a row in SQL Server?

Using SQL Server Management StudioClick the tab for the table with the columns you want to copy and select those columns. From the Edit menu, click Copy. Click the tab for the table into which you want to copy the columns. Select the column you want to follow the inserted columns and, from the Edit menu, click Paste.


1 Answers

I don't have a root cause. However, a comment on a blog led me to realise that the problem only exists when you right click and go 'Select Top X' or similar. If you go 'new query' and manually enter that query, you can then copy without headers.

I'm still looking for the root cause and a complete solution. Will update my post if I discover anything further.

like image 76
WiredEarp Avatar answered Sep 21 '22 08:09

WiredEarp