Solved

sybase bcp out command - would like to have where statement to limit bulk out data

Posted on 2014-03-18
5
1,147 Views
Last Modified: 2014-05-18
hello
I would like to bulk out data from sybase one table but with having where statement. i.e. date column >= '2014/1/1'. would somebody kindly help to advice how this is possible...?

thanks in advance!
sleepingluke
0
Comment
Question by:sleepingluke
5 Comments
 
LVL 26

Expert Comment

by:wilcoxon
ID: 39938626
This is not possible using bcp.  The simplest way I know to do this is to install sqsh (http://sourceforge.net/projects/sqsh/ - it used to be sqsh.org but that appears to be gone) and do a query like "select * from table where date >= '2014/1/1'; -mbcp".
0
 
LVL 1

Expert Comment

by:troublesaga
ID: 39938996
The other option that I know is to create a view and bcp out the view.
0
 
LVL 26

Accepted Solution

by:
wilcoxon earned 500 total points
ID: 39939688
The last option I can think of is to bcp out the full table and then use an awk/perl script to essentially grep the rows you want (only works for char-format bcp and not binary format).  However,  I think both my suggestion for sqsh and troublesaga's view suggestion are better options (if you can do them).

sqsh is incredibly useful.  I use it all the time and dread whenever I'm on a system where I'm stuck with isql.
0
 
LVL 13

Expert Comment

by:alpmoon
ID: 39941497
I second  troublesaga's suggestion. I guess creating a view would be easiest. You will use view name instead of table name in bcp command.
0
 

Author Closing Comment

by:sleepingluke
ID: 40073777
thank you very much!!!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now