473,765 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jan 11 '08 #1
4 4933
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******** *************** ***********@k2g 2000hse.googleg roups.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

Jan 11 '08 #2
On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@d el.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******** *************** ***********@k2g 2000hse.googleg roups.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
Jan 11 '08 #3
On Jan 11, 12:06 pm, "ee...@hotmail. com" <ee...@hotmail. comwrote:
On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@d el.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******** *************** ***********@k2g 2000hse.googleg roups.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.
Jan 11 '08 #4
Have you solved this one?

--

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


<ee***@hotmail. comwrote in message
news:97******** *************** ***********@i7g 2000prf.googleg roups.com...
On Jan 11, 12:06 pm, "ee...@hotmail. com" <ee...@hotmail. comwrote:
>On Jan 11, 11:29 am, "Jack Vamvas" <DEL_TO_RE...@d el.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******* *************** ************@k2 g2000hse.google groups.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
discrepancie s 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.

Jan 16 '08 #5

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

Similar topics

1
1592
by: William Holroyd | last post by:
I recently took over a web project that utilizes a MS SQL2000 server via PHP. The web server itself is screwed and so I'm trying to configure another box to act as a temporary server until i can get the current one fixed and updated. I looked at the phpinfo() output on the current webserver and saw the previous guy had configured php with "--with-sybase=/usr/local/freetds". I have no clue as to why this was done and can't for the life of...
18
4617
by: mountain man | last post by:
Greetings to all database professionals and laymen, Let us make a bold assumption that we have developed a software tool for the SQL Server environment which simply acts as an interface between an end-user in an organization and the database, through the exclusive use of stored procedures which are authored by the organization or by software developers. All development work at the application software level may thereby be conducted...
14
3507
by: erezep | last post by:
I'm running a site balanced between 5 apache servers running on FC3, apache 2.0.53,php 4.3.4,freetds 0.63. I have this strange problem that sometimes, not even times of load, the connections table at the sql server gets to a very high value (about 1000) my average is below 200. I don't know how to solve this, but I know that if I restart the process of all my apache servers, everything turns ok,
16
10531
by: agrawal.solutions | last post by:
Hello Friends I am asking a very silly question but i dont find any solution fo this.. I am selectiong a recordset and want to populate a combobox where id would be inviseble and the content would. I am getting the recordset and the no of record but then i am unble to populate the combobox. I have already tried all the function starting form for each x in .... and while...wend and do....loop
13
4865
by: Filips Benoit | last post by:
Dear All, How can I show the resultrecords of a SP. I can be done by doubleclick the SPname? But how to do it by code. I want the following interface In my form the user 1 selects a SP (combobox showing a userfrinly name) 2 adds the related parameters
8
1458
by: David Lozzi | last post by:
I'm fairly new to ASP.Net 2.0 SQLDatasource objects. It defaults using TSQL statments for the SELECT, INSERT, UPDATE, DELETE commands, which is great and it works. However, I've always been taught that all SQL work should be completed by the SQL server, therefore use stored procedures even for the simplest of select statements. Does this still hold true for sqldatasources? Should I use procs instead of the default tsql?? Thanks, ...
2
3592
by: grezios | last post by:
Hi everybody and first of all thank you very much for your help, i am on a linux fedora core 5 server and i want to odbc connect to a windows 2003 server with MSSQL Server database. the iODBC is the name i used for defining the dsn i have created in the odbc.ini file which looks like this iODBC = MS SQL Server MSSQL = MAVE Driver = /usr/local/lib/libtdsodbc.so
0
1768
by: hassanali20 | last post by:
I've surfed this forum and found one thread which was talking about the same problem i've, but it didn't help in my situation. http://www.thescripts.com/forum/thread510563.html I could connect to MSSQL server using freetds 8.0 and able to run queries to MSSQL server, but the query doesn't fetch anything when it runs on a column having datatype as VARCHAR having special character as in <méxico> (note the second character) the acute accent. ...
3
2375
by: ckauvar | last post by:
The PHP below calls a stored procedure in a MSSQL database when I am using SQL in a Windows environment. I've recently switched to a UNIX environment and am now using ODBC (via FreeTDS) to connect to the MSSQL database. I need to rewrite the PHP below to use the odbc_connect terminology instead of the mssql_connect terminology. Can anyone help me with this? I know the changes are probably simple, but I don't even know where to start....
0
9568
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...
1
9957
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
9835
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
8832
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
7379
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
5276
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.