dbTalk Databases Forums  

using freetds tsql

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss using freetds tsql in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
eeb4u@hotmail.com
 
Posts: n/a

Default using freetds tsql - 01-10-2008 , 09:20 PM






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

Reply With Quote
  #2  
Old   
Jack Vamvas
 
Posts: n/a

Default Re: using freetds tsql - 01-11-2008 , 10:29 AM






Is this an inline sql statement or a stored procedure?

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com




<eeb4u (AT) hotmail (DOT) com> wrote

Quote:
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



Reply With Quote
  #3  
Old   
eeb4u@hotmail.com
 
Posts: n/a

Default Re: using freetds tsql - 01-11-2008 , 11:06 AM



On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE... (AT) del (DOT) com> wrote:
Quote:
Is this an inline sql statement or a stored procedure?

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com

ee... (AT) hotmail (DOT) com> wrote in message

news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559 (AT) k2g2000hse (DOT) 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


Reply With Quote
  #4  
Old   
eeb4u@hotmail.com
 
Posts: n/a

Default Re: using freetds tsql - 01-11-2008 , 02:40 PM



On Jan 11, 12:06 pm, "ee... (AT) hotmail (DOT) com" <ee... (AT) hotmail (DOT) com> wrote:
Quote:
On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE... (AT) del (DOT) com> wrote:



Is this an inline sql statement or a stored procedure?

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com

ee... (AT) hotmail (DOT) com> wrote in message

news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559 (AT) k2g2000hse (DOT) 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
oops! result is tab delimited. Should be able to do something now.


Reply With Quote
  #5  
Old   
Jack Vamvas
 
Posts: n/a

Default Re: using freetds tsql - 01-16-2008 , 04:05 AM



Have you solved this one?

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com




<eeb4u (AT) hotmail (DOT) com> wrote

Quote:
On Jan 11, 12:06 pm, "ee... (AT) hotmail (DOT) com" <ee... (AT) hotmail (DOT) com> wrote:
On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE... (AT) del (DOT) com> wrote:



Is this an inline sql statement or a stored procedure?

--

Jack Vamvas
___________________________________
Search IT jobs from multiple sources- http://www.ITjobfeed.com

ee... (AT) hotmail (DOT) com> wrote in message

news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559 (AT) k2g2000hse (DOT) 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

oops! result is tab delimited. Should be able to do something now.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.