473,796 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Command SQL with carriage return


Hi,

I have been using the db2 export function for quite sometimes.
Everytime I want to use it I have to remove every carriage return from
my SQL statement and have it all on one line as shown in the following
simplistic example:

db2 export to myfile.txt of del select a,b,c from staff

This can be time consuming when you have big SQL joining many tables
that contains several where clauses.

Is it possible to somehow pass a SQL with carriage returns? Have the
SQL store in a text file for example like so

SELECT A,
B,
C
FROM STAFF
Let me know.....
THANKS

Oct 11 '06 #1
6 8753
Hi,

Does anybody know how to do it? I was able to get close to what I want
but the data is not exported in a comma delimited file, it simply
outputs evrything:

Example:
extract.sql contains my SQL with carriage return and ; is the
termination character.
output.txt is the report it generates.
-x indicates to Suppress printing of column headings

C:\Program Files\IBM\SQLLI B\BIN>db2 -x -td; -f "extract.sq l" -r
"output.txt "

Please help....

Oct 11 '06 #2
Continue to use the export command. put all the export statements in a
single file. You can use new lines to your heart's content. End the
last line with a ";". then execute db2 -tvf "export_stm ts". This
should work.

Lew

no_spam_for_gma n wrote:
Hi,

Does anybody know how to do it? I was able to get close to what I want
but the data is not exported in a comma delimited file, it simply
outputs evrything:

Example:
extract.sql contains my SQL with carriage return and ; is the
termination character.
output.txt is the report it generates.
-x indicates to Suppress printing of column headings

C:\Program Files\IBM\SQLLI B\BIN>db2 -x -td; -f "extract.sq l" -r
"output.txt "

Please help....
Oct 11 '06 #3
Thank you so much, that worked!

Oct 11 '06 #4
VGD
Try this

SELECT A, ^
B, ^
C ^
FROM STAFF

It works on Windows Command Line

Regards.

Vicente

"no_spam_for_gm an" <ga****@gmail.c omescribió en el mensaje
news:11******** **************@ m7g2000cwm.goog legroups.com...
>
Hi,

I have been using the db2 export function for quite sometimes.
Everytime I want to use it I have to remove every carriage return from
my SQL statement and have it all on one line as shown in the following
simplistic example:

db2 export to myfile.txt of del select a,b,c from staff

This can be time consuming when you have big SQL joining many tables
that contains several where clauses.

Is it possible to somehow pass a SQL with carriage returns? Have the
SQL store in a text file for example like so

SELECT A,
B,
C
FROM STAFF
Let me know.....
THANKS


Oct 16 '06 #5
Please use Command Editor. Not CLP.

Oct 16 '06 #6
I find execute db2 -tvf "export_stm ts" is the best way. I can store my
SQL in files.

Oct 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1902
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to have o create a temporary file on the web server everytime someone want to run and export. When I call the ExportToBrowser function the user gets the standard open/save file dialog box. If the user chooses to save the file the program works...
4
18702
by: Josh | last post by:
Hi, I'm using System.Data.DataSet.ReadXml to convert some xml from a webservice to a DataSet. The xml looks like: <?xml version="1.0" encoding="UTF-8"?><root><prioritiesTable><description>blah blah blah blah</description></prioritiesTable></root> The important thing here is the which I beleive should be a single
2
4131
by: Andrew Chanter | last post by:
I have a VBA function that returns a string including "vbcr" (VB Carriage Return) to seperate a list into multiple rows, eg Item1 & vbcr & Item2 & vbcr & Item3 This works as planned in the immediate window, producing a list where a Carriage Return follows each item. But when I output the result into either an Access query or form, instead of carriage returns I get little square symbols between each of the items. Is anyone able to tell...
2
2340
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost when pulling data from an SQL database. The thing that frustrates me the most, is that when I use Enterprise Manager, the carriage returns ARE THERE. It looks fine until I pull it out.
0
1513
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to have o create a temporary file on the web server everytime someone want to run and export. When I call the ExportToBrowser function the user gets the standard open/save file dialog box. If the user chooses to save the file the program works fine,...
34
6882
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: 1) get whole string of input line 2) preset table of strings matching <command> 3) preset table of function calls
0
1681
by: Bryan Ax | last post by:
I'm trying to fix a bug in someone else's code. He's got a string saved in a database such as: <xsl:variable name="Var1"> <xsl:choose> <xsl:when test="@SomeAttribute &gt; 1'"> <xsl:value-of select="'Y'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'N'"/>
2
12916
by: Nefaria | last post by:
I'm constantly required to export data from Access to Excel for formatting and find it extremely difficult to remove the Chr(10) and Chr(13) codes from the imported data. A search and replace in Excel doesn't recognize the characters and I can find no 'quick' way of fixing this problem, is there a way of making sure the characters don't come across during an export (they appear as boxes in Excel) or is there code that I can use in Excel to...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.