Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCP and -h option?

Status
Not open for further replies.

sagn

Programmer
Jun 7, 2001
166
US
Hi

I would like to bcp a table into a text file.
the text file must have the results in a paritcular order.

I am trying to specify the order using the -h
option where my hint is 'order'

my command line looks like


BCP db.dbo.tablename OUT H:\table.txt -c
-h "order column_name asc" -U user -P pwd

I get an error saying I have incorrect syntax near key word
order. I have tried adding the word 'by' and got the same erorr.

Any ideas?

Thanks

diane
 
I will give it a shot since nobody answers it.

Does it need a "by" behind the word "order"?
BCP db.dbo.tablename OUT H:\table.txt -c
-h "order by column_name asc" -U user -P pwd

 
I tried that and it dod not

then I tried putting in an entire slect statement
for the -h option
IE -H "SELECT * FROM TABLE ORDER BY COLUMN"
AND IT WORKED...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top