Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert MSSQL queries to mySQL?

Status
Not open for further replies.

haseldow

Programmer
May 18, 2003
1
US
Hi,

I'm working on a project that compares server processor loads to backup schedules and other processes that might consume processor time.

On Linux servers I use SAR (System Activity Report) and it works like a charm.

But on windows servers I'm forced to use perfmon (Microsoft Performance Monitor, which is a builtin monitor on MS windows).

Perfmon can only write logs to text files OR in MS SQL database. Because of the nature of how my program works, the data must be in a database.

I have only one Linux server I can use for this project so I can't use MS SQL and I can't use the production servers which are being monitored to store this data. So the Linux server is the only computer I can use and it has mySQL.

I have installed myODBC on the production servers in hope that it could be used to write the data to mySQL but here the problem arises. Perfmon seems to use SQL queries that are MS SQL specific and doesen't work with mySQL even with myODBC.

Example 1 (From windows event viewer.):
You have an error in your SQL syntax near 'IDENTITY PRIMARY KEY, MachineName varchar(1024) NOT NULL, ' at line 1.

Example 2 (From the linux server which runs my program. mySQL started with --log=/var/log/wtf.log):
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
Time Id Command Argument
030305 10:03:33 1 Connect logger@haseldow on loganalyzer
1 Query CREATE TABLE CounterDetails(CounterID int IDENTITY PRIMARY KEY, MachineName varchar(255) NOT NULL, ObjectName varchar(255) NOT NULL, CounterName varchar(255) NOT NULL, CounterType int NOT NULL, DefaultScale int NOT NULL, nstanceName varchar(255), InstanceIndex int, ParentName varchar(255), ParentObjectID int)
1 Query select GUID, RunID, NumberOfRecords from DisplayToID where DisplayString = 'Haseldow'

So the question is: How can I translate MS SQL specific queries so that I can use mySQL? Is there any free(!) socket listeners/translators that I can use? Can I do this in some other way?

Regards,
-Haseldow
 
There is no automated system that I know of. SQL queries tend to be too idiosyncratic for that.

Just looking at the query that creates the table, it's the "IDENTITY" keyword that MySQL is barfing on. The MySQL equivalent is "auto_increment".

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top