473,624 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing a text file containing SQL

Hi,

DB2 Version 7.1 FP11 on Windows XP

I have a text file containing SQL. The text file was created using db2look.

CONNECT TO MYDB user db2admin using xxxxxx;

------------------------------------------------
-- DDL-Anweisungen für Tabelle "DB2ADMIN"."ADD PRICEDATA"
------------------------------------------------

CREATE TABLE "DB2ADMIN"."ADD PRICEDATA" (
"APD_ID" INTEGER
IN "USERSPACE1 " ;
-- DDL-Anweisungen für Indizes für Tabelle "DB2ADMIN"."ADD PRICEDATA"

CREATE UNIQUE INDEX "DB2ADMIN"."IDX _APD_ID" ON "DB2ADMIN"."ADD PRICEDATA"
("APD_ID" ASC);

COMMIT WORK;

CONNECT RESET;

TERMINATE;

What I would like to do is, execute this text file from the db2 command line
and have all the commands in the text file executed. How do I do this? I
must be missing something really simple. What I have tried is:

db2cmd -t -f db2look.sql

but the -f parameter is apparently only available in version 8.

db2cmd -t db2look.sql

simply opens the text editor and displays the sql text in the editor.

Regards

Rudolf Bargholz
Nov 12 '05 #1
2 21537

"Rudolf Bargholz" <ba******@spamc op.net> wrote in message
news:10******** *******@fuchs.c yberlink.ch...
Hi,

DB2 Version 7.1 FP11 on Windows XP

I have a text file containing SQL. The text file was created using db2look.
CONNECT TO MYDB user db2admin using xxxxxx;

------------------------------------------------
-- DDL-Anweisungen für Tabelle "DB2ADMIN"."ADD PRICEDATA"
------------------------------------------------

CREATE TABLE "DB2ADMIN"."ADD PRICEDATA" (
"APD_ID" INTEGER
IN "USERSPACE1 " ;
-- DDL-Anweisungen für Indizes für Tabelle "DB2ADMIN"."ADD PRICEDATA"

CREATE UNIQUE INDEX "DB2ADMIN"."IDX _APD_ID" ON "DB2ADMIN"."ADD PRICEDATA"
("APD_ID" ASC);

COMMIT WORK;

CONNECT RESET;

TERMINATE;

What I would like to do is, execute this text file from the db2 command line and have all the commands in the text file executed. How do I do this? I
must be missing something really simple. What I have tried is:

db2cmd -t -f db2look.sql

but the -f parameter is apparently only available in version 8.

db2cmd -t db2look.sql

simply opens the text editor and displays the sql text in the editor.

Regards

Rudolf Bargholz

from any command prompt (not DB2 command prompt), issue the following:

db2 -tvf db2look.sql
Nov 12 '05 #2
Thanks Mark. Got it to work now.
from any command prompt (not DB2 command prompt), issue the following:

db2 -tvf db2look.sql


Regards

Rudolf
Nov 12 '05 #3

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

Similar topics

2
5515
by: David Thomas | last post by:
Hi there, I am trying to store data in a text file and output it to the browser using PHP. All very easy - if I was using English! the problem is, I want to use Japanese and I'm finding it a tad difficult to get PHP to understand. I have two files, a text file containing data to display and a php file with a script to display the data. I can get the contents of a text file displayed in English, no problemo, but in Japanese, it's another...
1
3917
by: Gema Gema | last post by:
I have a large collection of directories full of various files and am looking to create custom text files for the contents of each directory. Here is the situation: The directories are named with a name and number, i.e. Smith1234567. I am looking to create a text file named with the number portion of the directory name (1234567.txt). The contents of the text file would look similar to the following, where the "TIF" files at the end of...
2
2216
by: Liz | last post by:
Hi, Learning Java, want to play with XML. I have a text file that looks like this. # PER 2:04 AM 06/09/2003 # plotfile for a circle of radius 5 # at the origin but rotated 25 degrees about the y axis # y is up, x is to the right, z is away from you 721 4.53154, 0.00000, -2.11309
2
9187
by: Tony Murphy | last post by:
I've got an application that sends emails (not spam!). The application reads a template file (html/text) into a string, the string is processed and placeholders filled in as appropiate. I call a 3rd party api for sending the email, the api is written in c, so i need to convert the string into LPSTR (windows c style string?), i'm from unix world and new to windows mutant. I know that c_str() converts a string to a c string and data()...
8
18223
by: Phil Slater | last post by:
I'm trying to process a collection of text files, reading word by word. The program run hangs whenever it encounters a word with an accented letter (like rôle or passé) - ie something that's not a "char" with an ASCII code in 0..127 I've searched the ANSI C++ standard, the internet and various text books, but can't see how to workaround this one. I've tried wchar_t and wstring without success. But rather than spending lots of time on...
13
4173
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them from the html page (replace the words in the html page with blank space) I'm new to python and could use a little push in the right direction, any ideas on how to implement this? Thanks!
2
10028
by: Sheldon | last post by:
I'm using DoCmd.TransferText acImportDelim... to import a tab-delimited ..txt file using an Import Specification file and that works fine. The problem is that a few records could have double-quotes in one of the ten fields and that causes an "Unparsable Record" error and the remaining fields for those records are blank. This is part of a process that should not require manual intervention i.e. using an editor to remove the ". Is there a...
4
3796
by: Jyothish | last post by:
I have a file input.txt which has data like 0 0 0 0 0 0 1 0 0 0 6 0 9 0 0 0 1 0 1 1 0 1 0 0 0 0 4 0 0 0 3 0 1 5 6 I need to read this file and store it in a 2D array. Plz tell me .. how to do that..
1
2026
by: bmsbms | last post by:
I want to write a c program which uses a text file containing 2 columns, Using fopen() I opened the file but how to seperate the both columns in seperate arrays?
0
8234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8677
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
8620
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
8335
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
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
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...
1
2605
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

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.