Solved

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

Posted on 2014-03-18
5
1,266 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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