Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-03-2018, 02:08 PM
LICENSED TO ILL's Avatar
LICENSED TO ILL LICENSED TO ILL is offline
Member
 
Join Date: Oct 2005
Posts: 733
Default SQL HELL-P

Its been a while since I had to code and export with MS SQL. So please excuse my incompetence

The tables I am "exporting" I'd like to get into an excel sheet with the column headers. None of the quick buttons nor my 10 minutes of search can do that for me.

Is there a quick way that someone can post for me please! Thanks...
__________________
Spoiler:
Quote:
Originally Posted by Abelian Grape View Post
Nothing gay about mirin' another bro's gains.
Quote:
Originally Posted by campbell View Post
Want to become aware of my fist?
Quote:
Originally Posted by OddSox View Post
this might be my favorite thread on the AO
Reply With Quote
  #2  
Old 04-03-2018, 02:32 PM
BruteForce's Avatar
BruteForce BruteForce is offline
Member
SOA AAA
 
Join Date: Apr 2013
Studying for More Money
Favorite beer: Wurzel Bier
Posts: 11,129
Default

I use MS SQL Server 2014. If you can export the data without the headers, you could just copy the first row of data with headers (shift+ctrl+c) and then paste that in above your exported data.
__________________
ASA

Quote:
Originally Posted by Actuary321 View Post
I would really hate to bring Pokémon to a gun fight.
Reply With Quote
  #3  
Old 04-03-2018, 02:37 PM
LICENSED TO ILL's Avatar
LICENSED TO ILL LICENSED TO ILL is offline
Member
 
Join Date: Oct 2005
Posts: 733
Default

Nope, that didn't do it (the shift-ctrl-c)
__________________
Spoiler:
Quote:
Originally Posted by Abelian Grape View Post
Nothing gay about mirin' another bro's gains.
Quote:
Originally Posted by campbell View Post
Want to become aware of my fist?
Quote:
Originally Posted by OddSox View Post
this might be my favorite thread on the AO
Reply With Quote
  #4  
Old 04-03-2018, 03:16 PM
Abelian Grape's Avatar
Abelian Grape Abelian Grape is offline
Meme-ber                         Meme-ber
CAS
 
Join Date: Jul 2014
Posts: 41,417
Default

Are you not able to just run a select query then copy/paste the results? I do that all the time.
Reply With Quote
  #5  
Old 04-03-2018, 03:18 PM
redearedslider's Avatar
redearedslider redearedslider is offline
Member
CAS
 
Join Date: Oct 2015
Posts: 13,356
Default

Quote:
Originally Posted by Abelian Grape View Post
Are you not able to just run a select query then copy/paste the results? I do that all the time.


Unless you want to select just the column names using a query?
__________________
Quote:
Originally Posted by Abraham Weishaus View Post
ASM does not have a discussion of stimulation, but considering how boring the manual is, maybe it would be a good idea.
Reply With Quote
  #6  
Old 04-03-2018, 03:42 PM
Tacoactuary's Avatar
Tacoactuary Tacoactuary is offline
Member
CAS Non-Actuary
 
Join Date: Nov 2014
Location: Des Moines, IA
College: Vanderbilt, UIUC
Favorite beer: Yazoo Sue
Posts: 1,128
Default

Tools > Options > Query Results > Sql Server > Results to Text

Check the box that says "Include column headers in the result set"
__________________
ACAS 7 8 9
Reply With Quote
  #7  
Old 04-03-2018, 03:55 PM
Abelian Grape's Avatar
Abelian Grape Abelian Grape is offline
Meme-ber                         Meme-ber
CAS
 
Join Date: Jul 2014
Posts: 41,417
Default

Here's what I see whenever I right click the output pane:

Reply With Quote
  #8  
Old 04-03-2018, 04:04 PM
redearedslider's Avatar
redearedslider redearedslider is offline
Member
CAS
 
Join Date: Oct 2015
Posts: 13,356
Default

Ctrl c and ctrl shift c seem to do the same thing for me
__________________
Quote:
Originally Posted by Abraham Weishaus View Post
ASM does not have a discussion of stimulation, but considering how boring the manual is, maybe it would be a good idea.
Reply With Quote
  #9  
Old 04-03-2018, 04:32 PM
kittens kittens is offline
Member
SOA
 
Join Date: Jul 2011
Posts: 1,057
Default

is it a really large table? If not, I just run select * from table, click the top corner of the grid to highlight all, and right click to copy with headers

Another way will be to go to object explorer, right click on the database, tasks, export data and follow the wizard

note I'm using SQL server 2008
Reply With Quote
  #10  
Old 04-03-2018, 07:26 PM
Arlie_Proctor Arlie_Proctor is offline
Member
CAS AAA
 
Join Date: Dec 2001
Location: N.J.
College: Indiana University
Favorite beer: Becks
Posts: 1,181
Default

Run the query in VBA using ADO and use the copyfromrecordset method. Works every time and the column headers are always there.
Reply With Quote
Reply

Tags
microsoft sql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 10:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.25440 seconds with 9 queries