PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > using freetds tsql
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
using freetds tsql

Réponse
 
LinkBack Outils de la discussion
Vieux 11/01/2008, 03h20   #1
eeb4u@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut using freetds tsql

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
  Réponse avec citation
Vieux 11/01/2008, 16h29   #2
Jack Vamvas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: using freetds tsql

Is this an inline sql statement or a stored procedure?

--

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




<eeb4u@hotmail.com> wrote in message
news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559@k2g2000hse.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



  Réponse avec citation
Vieux 11/01/2008, 17h06   #3
eeb4u@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: using freetds tsql

On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@del.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...@hotmail.com> wrote in message
>
> news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559@k2g2000hse.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
  Réponse avec citation
Vieux 11/01/2008, 20h40   #4
eeb4u@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: using freetds tsql

On Jan 11, 12:06 pm, "ee...@hotmail.com" <ee...@hotmail.com> wrote:
> On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@del.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...@hotmail.com> wrote in message

>
> >news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559@k2g2000hse.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.
  Réponse avec citation
Vieux 16/01/2008, 10h05   #5
Jack Vamvas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: using freetds tsql

Have you solved this one?

--

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




<eeb4u@hotmail.com> wrote in message
news:971edef6-3d44-48ad-adac-d1f39ef63d52@i7g2000prf.googlegroups.com...
> On Jan 11, 12:06 pm, "ee...@hotmail.com" <ee...@hotmail.com> wrote:
>> On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@del.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...@hotmail.com> wrote in message

>>
>> >news:0d9a69ed-bf9f-4ad1-b215-99e2c7d6d559@k2g2000hse.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.



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h19.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,23459 seconds with 13 queries