Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Been an analyst using SQL Anywhere for a few years and just getting into database management. Regarding writing/developing procedures/functions, is there a particuliar programming language that is used or patterned after?

asked 02 Dec '10, 15:21

zippidydo's gravatar image

zippidydo
377151521
accept rate: 0%

edited 15 Mar '13, 18:49

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297


SQL Anywhere supports two dialects of stored procedures:

  • The original dialect was introduced into the product in 1992 and is called WATCOM SQL. The name is derived from the name of the company "WATCOM" and name of the product at that time. See http://en.wikipedia.org/wiki/Watcom for more information about Watcom the company. In its early years, WATCOM was known for its compiler technology and in particular its WATFOR Fortran compiler which was used by Universities around the world. As such, I would presume that the experience learned creating these compilers had some effect on the design of this dialect.

  • The second dialect is TSQL and was added to the SQL Anywhere product in version 6 and is based on the TSQL dialect developed and used by Sybase ASE (and inherited by Microsoft SQL Server).

The WATCOM SQL dialect closely resembles the ISO/ANSI SQL/2008 standard.

permanent link

answered 02 Dec '10, 21:05

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

1

@Mark: Am I right to notice some kind of bias in favour of the first dialect in your description? If so, I would fully agree:) - And I am sure Watcom SQL seems much more familiar to those with experience in common programming languages...

(03 Dec '10, 08:54) Volker Barth
1

I vote "Watcom SQL"... 99.9% of Foxhound is written in it, including the enire GUI.

(03 Dec '10, 12:59) Breck Carter
Comment Text Removed
1

My preference is Watcom SQL, but users that are familiar with ASE or MS SQL may be more comfortable using the TSQL dialect.

(03 Dec '10, 13:22) Mark Culp

@Mark: By the way, are there any iAnywhere staff members who have been involved with the development of the Watcom compiler products? (Yep, call me curios.)

(03 Dec '10, 14:13) Volker Barth

@Volker: Yes, there are still a few.

(03 Dec '10, 15:45) Mark Culp

@Mark: Hmm, you can bet the curiosity isn't really satisfied, I was looking for names... - I guess us users here do not only share a admiration for you SQL heroes, there's place for compiler gurus, too:)

(03 Dec '10, 17:20) Volker Barth
1

@Volker: I am a little reluctant to name others without their permission. I will say that I know of at least six staff that worked on the Watcom compilers/interpreters and (trying not to give away too much info) some of them are users on this forum. I'll leave it as an exercise to the reader to figure out who. Note: I am not one of them.

(03 Dec '10, 20:48) Mark Culp

@Mark: I fully appreciate your point of view, as it really would be unfair to tell about other persons's CV. (And yes, as a typical German citizen, I do care much about privacy - cf. the German Google StreetView debate...) - Besides that, I do have some suspicions:)

(04 Dec '10, 11:06) Volker Barth
More comments hidden
showing 4 of 8 show all flat view

It doesn't really matter if you prefer watcom or T-SQL because you can translate the code from watcom to T-SQL and vice versa inside the Sybase Central

permanent link

answered 03 Dec '10, 11:47

Martin's gravatar image

Martin
9.0k130169257
accept rate: 14%

...though there are advanced cases of Watcom SQL code that cannot be converted to T-SQL (and possibly vice versa).

(03 Dec '10, 12:44) Volker Barth
Comment Text Removed

I've discovered you can't mix these two constructions in the same stored procedure (no matter how many lines apart they are) ...select <calculation> as VariableName1... and ...select VariableName2 = <calculation>... (disclaimer: I only know up to version 10.0.1)

(04 Dec '10, 12:44) carolstone

To complete the picture:

I guess your question is focused on stored functions and procedures in SQL, and that's what the answers explain.

But you can also write (or re-use) stored procedures and functions in other programming languages and create an SQL interface for them. This includes

  • C/C++ via Embedded SQL/ODBC
  • CLR (aka Dot.Net)
  • Java
  • Perl
  • PHP

If this is your intention, have a look at the CREATE PROCEDURE statement for external procedures.

permanent link

answered 03 Dec '10, 12:24

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822
accept rate: 34%

I was wondering when someone was going to mention all the other languages :)

(03 Dec '10, 12:58) Breck Carter

@Breck: Are you saying I have insulted the general "Stealth marketing" rule? I feel ashamed:)

(03 Dec '10, 13:51) Volker Barth

Any suggestions on how to get started writing procedures/functions?

(10 Dec '10, 21:56) zippidydo
Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×90
×34
×11

question asked: 02 Dec '10, 15:21

question was seen: 9,203 times

last updated: 15 Mar '13, 18:49