Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > MySQL > Wierd semicolon error with Mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-02, 18:39
riznick riznick is offline
Registered User
 
Join Date: Dec 2002
Posts: 4
Wierd semicolon error with Mysql

I have been having this problem with my mysql server. I get errors when I use the semicolon at the end of a sql command. I believe it is a server setting that is botched. Can anyone help?

Error message:
SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near '; ' at line 1


Code:
"Select * from MessageboardTopics ;"


If I remove the semicolon, the command works. If I insert a semicolon, the command fails.
__________________
Rick Paul
Reply With Quote
  #2 (permalink)  
Old 12-07-02, 00:27
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Where are you executing the sql statement ?
Reply With Quote
  #3 (permalink)  
Old 12-09-02, 17:50
epauleyii epauleyii is offline
Registered User
 
Join Date: Dec 2002
Posts: 2
Re: Wierd semicolon error with Mysql

Quote:
Originally posted by riznick
I have been having this problem with my mysql server. I get errors when I use the semicolon at the end of a sql command. I believe it is a server setting that is botched. Can anyone help?

Error message:
SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near '; ' at line 1


Code:
"Select * from MessageboardTopics ;"


If I remove the semicolon, the command works. If I insert a semicolon, the command fails.


If the select statement in question is being made using an API the semicolon is not required.
Reply With Quote
  #4 (permalink)  
Old 12-09-02, 18:27
riznick riznick is offline
Registered User
 
Join Date: Dec 2002
Posts: 4
Quote:
Originally posted by rnealejr
Where are you executing the sql statement ?


Using Chilisoft ASP

Without the semicolon, it runs fine.
With the semicolon, I get an error.

----------

SQL = "Select * from MessageboardTopics ;"

set objStoreConn = Server.CreateObject("ADODB.Connection")
objStoreConn.Open "DSN=xxx;UID=xxx;PWD=xxx"
set rs = Server.CreateObject ("ADODB.Recordset")
rs.Open SQL, objStoreConn

if not rs.eof then
while not rs.eof
response.write rs(0)
rs.movenext
wend
else
response.write "No records exist"
end if

rs.Close
set rs = Nothing

objStoreConn.Close
set objStoreConn = Nothing
__________________
Rick Paul
Reply With Quote
  #5 (permalink)  
Old 12-09-02, 22:31
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Just leave off the semicolon. This causes problems in so many development environments. Which platform are you using - ms or unix ?
Reply With Quote
  #6 (permalink)  
Old 12-10-02, 13:53
riznick riznick is offline
Registered User
 
Join Date: Dec 2002
Posts: 4
Leaving out the semicolon works for now, but I would like to find out why it doesnt like the semicolon. In the future, I may want to put multiple statements in one sql call. I would need to separate both the statements with something (?

For the first month, the semicolon worked fine. Then one day, all my SQL calls got errors. I had to scrape through all the code to remove any semicolon in the code.

Unix Platform

Quote:
Originally posted by rnealejr
Just leave off the semicolon. This causes problems in so many development environments. Which platform are you using - ms or unix ?
__________________
Rick Paul
Reply With Quote
  #7 (permalink)  
Old 12-10-02, 23:09
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
At the moment, you will not be able to handle multiple recordsets in unix using chilisoft -so having multiple sql statements may not be feasible. Have you tried to run multiple sql statements in chilisoft using a semicolon ?
Reply With Quote
  #8 (permalink)  
Old 12-11-02, 13:39
riznick riznick is offline
Registered User
 
Join Date: Dec 2002
Posts: 4
Rather than working around the semicolon, I would like to simply fix this problem. Why did all the scripts stop working one day? Why did I need to remove the semicolon?


Now we are getting a little bit off topic but...

I wish to get the autonumber of a recently added row. In doing so, I put the insert and select in the same query.

If I did this call using two separate commands, there may be a problem. If two people insert at the same time, it is possible for both of them return the value of the same last inserted row. One of the people will have the incorrect value.

I wish to do an insert, and then a select on the same command. Doing it this way ensures me that I will get the right number in a multuser environment.

http://www.4guysfromrolla.com/webtec...122600-1.shtml



Quote:
Originally posted by rnealejr
At the moment, you will not be able to handle multiple recordsets in unix using chilisoft -so having multiple sql statements may not be feasible. Have you tried to run multiple sql statements in chilisoft using a semicolon ?
__________________
Rick Paul
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On