On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@del.comwrote:
Is this an inline sql statement or a stored procedure?
--
Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com
<ee...@hotmail.comwrote in message
news:0d**********************************@k2g2000h se.googlegroups.com...
I am connecting to MS SQL 2000 from Red Hat EL4 using freetds and
currently running queries to get counts on tables etc. When running
SELECT queries I notice that the data returns and I have to parse out
the field names etc. Is there any easier way to extract the data in a
comma separated form?
I was thinking of reading the contents into a structured file or
buffer and then getting the field names that way. However I thought I
might be over engineering a simple query script, but I haven't come up
with a simpler way yet.
Basically, I am trying to writing a script on linux that queries the
database I and with the results of that query it will create an insert
statement for another database.
Any suggestions are welcome.
Mike
This will be a simple select query that I can turn into an insert
statement via a shell script. We have several databases that are
currently replicated via GoldenGate and "once in a blue moon" it fails
to replicate the complete transactions from one of the databases to
one of the others. This has only happened twice in 6 months when our
flakey frame relay connection took a slight hit. It wasn't noticed
for sometime and therefore our goldengate trail files are gone (we
can't replay them). I wanted to add monitoring to identify table row
discrepancies between the 4 databases (which I have done) and then
create a script that will query a known good database and generate the
insert statements for the known bad database. The "monitor/insert
statement builder scripts" reside on a RHEL platform and I connect to
SQLSERVERs which are running on a Windows 2003 server. I am
connecting to SQLSERVER via tsql (the utility from freetds.org). It
returns the counts among other values from the tables, and I am able
to parse the output to identify the actual count then perform the
logic to decide which databases are out of sync. That is simple, but
when running a select statement, it returns the column headers and the
data and it is not a very straight forward task to code the correct
syntax for my inserts which obviously require quotes, comma separators
etc. I felt there must be a better way of doing this, that is,
extracting the data with field terminators at least.
Thanks,
Mike