September 11, 2008 at 5:00 am
Hi guys,
I'm having some trouble with bcp commands.
1. what is the command to use to just copy one column of a table into a data file using queryout option?
2. How would I just copy a row from a table into a data file?
3. Also how would I copy names from a table into a data file and order by last name, then first name?
I'm very new to bcp so I only know the very very basics.
I'd greatly appreciate your help.
Thanks
M.
September 11, 2008 at 1:14 pm
Does it have to be bcp or can you use some of the native SQL tools like DTS? DTS can do this very easily.
-- You can't be late until you show up.
September 11, 2008 at 3:34 pm
Thank you for your response.
Well, my professor wants us to use the bcp utility command.
I know how to copy a whole table into a data file, but how to choose just one column, I have no clue.
BCP doesn't seem to be something that's discussed very much, not much info online regarding it, other than msdn.
Thank you again for your response
Marjan
September 11, 2008 at 3:42 pm
so this is homework? Look up BCP in books online.
---------------------------------------------------------------------
September 11, 2008 at 3:52 pm
It's not really homework
It's something I need to learn how to do so I can use it for my project.
He really didn't go into much detail about bcp.
September 12, 2008 at 6:11 am
Homework/project - what's the difference?? You mentioned msdn. Here's the link. Use a query to get the data that you need. If you make a honest effort and get stuck, post the code showing what you've done. You'll get plenty of help. Without effort on your part, people will avoid this post as if it were a plague...
http://msdn.microsoft.com/en-us/library/ms162802.aspx
-- You can't be late until you show up.
September 12, 2008 at 9:18 am
Thanks, Yes at first msdn didn't seem helpful to me which is why I posted here.
Thought it would be too wordy to understand, so I was looking for an easy explanation.
But, when I read everything I found it easier to understand and actually found what I was looking for.
Well the difference between homework and project to me is that when you say homework you are insinuating that I'm only looking for answers, wanting you guys to do the work for me. A project however, means that I have to understand everything very well so I can apply it to my own stuff. If this is a site that helps understand sql server, what should it matter if its for work or school? 🙁
So, I'm sorry if I sounded a bit defensive, just didn't like the insinuation that's all.
September 12, 2008 at 9:41 am
Believe me, you'll find plenty of help here. As I stated, and I think most posters will agree, if you show an effort, and show what you've done so far and what problem(s) you're facing, they will help everytime. There are many sharp individuals here that have solved almost any problem imaginable and have given excellent guidance on the dos and donts of everything related to SQL. I think you'll be glad you're a member.
-- You can't be late until you show up.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply