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

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

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.

asked 26 Nov '12, 12:55

chillax's gravatar image

accept rate: 0%

edited 28 Nov '12, 03:26

Volker%20Barth's gravatar image

Volker Barth

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

if exists (select 1 from master..sysdatabases where name='emp_details') then
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?

permanent link

answered 26 Nov '12, 12:57

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

edited 26 Nov '12, 13:03

@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?

(26 Nov '12, 13:11) chillax
Replies hidden

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.

(26 Nov '12, 13:51) Mark Culp

FWIW, ASE (as MS SQL Server) uses an architecure where each database server instance has one particular master database and as many "attached" databases as one likes, and one can list any database via the master's sysdatabases table. - That's what the script seems to try to, and so I would conclude you're using ASE.

In contrast, a SQL Anywhere database server can run several databases, too, but does not use a particular master database, so each database is managed on its own, and there is no general sysdatabases table. Of course, there are other means to list all databases running on a SQL Anywhere server.

permanent link

answered 27 Nov '12, 03:27

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 27 Nov '12, 03:28

looks like checkpoint is not allowed inside if..go block, try directly running it.

permanent link

answered 27 Nov '12, 13:47

kk2ask's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 26 Nov '12, 12:55

question was seen: 12,227 times

last updated: 28 Nov '12, 03:26