cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Syntax error on executing a script in Sybase database

Former Member
14,060

I created a Sybase database emp_details using SQL Anywhere and Sybase Central. I had given emp/emp as dba username/password while creating.

The db got created and the files were generated in the given folder.

When I tried running the below script using Ineractive SQL:

use master
go

if exists (select 1 from master..sysdatabases where name='emp_details')
    checkpoint emp_details
go

It threw the following exception

Could not execute statement.
Syntax error near 'checkpoint' on line 2
SQLCODE=-131, ODBC 3 State="42000"
Line 4, column 1

Haven't been able to figure out what exactly the syntax issue is and have been stuck up with this for a while.

Any ideas?


Edit: Issue got resolved by installing Sybase ASE. Was able to run the script as it is.

View Entire Topic
MarkCulp
Participant

I think you are mixing dialect ... try doing this:

if exists (select 1 from master..sysdatabases where name='emp_details') then
    checkpoint;
end if;

Hmmm, but looking at what you are trying to do it looks like you may NOT be connected to a SQL Anywhere database because 'sysdatabases' table does not exist in a typical SQL Anywhere database. Are you connecting to ASE?

Former Member
0 Likes

@Mark Culp. I am trying to connect to an SQL Anywhere database, which now i think is wrong. All we have is the script and info that it should be a Sybase DB. So should we create a Sybase ASE DB? do they have the sysdatabases. If yes, can it be done using Sybase Central?

MarkCulp
Participant
0 Likes

Where or from whom did you get the script? I would go back to where-ever you got the script and ask the owner what type of database should be used.

If the database should be ASE then you should ask the ASE forum (see FAQ for details on newsgroups ... but do it quick because I believe all of the newsgroups are getting set to read-only on Dec. 1st). Note: I am not an ASE expert. You should likely use some ASE tool (isql) to run the script against an ASE database.