QUESTION:
Does anybody know if Common Table Expressions and User-defined functions (not from Java) are supported in Sybase?
ANSWER:
Microsoft SQL Server is based on Sybase 7.0. Sybase may not have Common Table Expressions (CTE) and User-Defined Functions, but there are equivalent ways to do the same thing.
For example CTE can be done either in nested queries or via temp tables using a number sign (#) in front of the table name.
For User Defined Functions, create a stored procedure with simple SQL code and call it via the exec function for example “exec my_sql_code”. This allows nesting of stored procedures.
Good SQL, good night.