By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,017 Members | 951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,017 IT Pros & Developers. It's quick & easy.

DB2 MIGRATION: SYBASE Functions list

P: n/a
All,

We have listed out the INBUILT Function differences between Sybase and
DB2.

Kindly provide your feedback or corrections and for CHANGES - DO WE
NEED TO CODE our own UDFs?

STRING FUNCTIONS

SYBASE DB2 REMARKS
=========================
ABS ABS NO CHANGE
ACOS ACOS NO CHANGE
CEILING CEILING NO CHANGE
COS COS NO CHANGE
COT COT NO CHANGE
DEGREES DEGREES NO CHANGE
EXP EXP NO CHANGE
FLOOR FLOOR NO CHANGE
LOG LOG NO CHANGE
LOG10 LOG10 NO CHANGE
PI - NO EQUIVALENT
POWER POWER NO CHANGE
RADIANS RADIANS NO CHANGE
RAND RAND NO CHANGE
ROUND ROUND NO CHANGE
SIGN SIGN NO CHANGE
SIN SIN NO CHANGE
SQRT SQRT NO CHANGE
SQUARE - NO EQUIVALENT
TAN TAN NO CHANGE

AGGREGATE FUNCTIONS

SYBASE DB2 REMARKS
======================
AVG AVG NO CHANGE
COUNT COUNT NO CHANGE
MAX MAX NO CHANGE
MIN MIN NO CHANGE
SUM SUM NO CHANGE

STRING FUNCTIONS

SYBASE DB2 REMARKS
========================================

ASCII ASCII NO CHANGE
CHAR CHR CHANGE
CHARINDEX POSSTROR LOCATE CHANGE 1
CHAR_LENGTH LENGTH NO CHANGE
DIFFERENCE DIFFERENCE NO CHANGE
LOWER LOWER OR LCASE OPTIONAL
LTRIM LTRIM NO CHANGE
PATINDEX POSSTR CHANGE 1
REPLICATE REPEAT CHANGE
REVERSE - NO EQUIVALENT
RIGHT RIGHT NO CHANGE
RTRIM RTRIM NO CHANGE
SOUNDEX SOUNDEX NO CHANGE
SPACE SPACE NO CHANGE
STR CHAR PARTLY EQUIVALENT 2
STUFF INSERT CHANGE
SUBSTRING SUBSTR CHANGE IN NAME SAME PARAMETERS

SYSTEM FUNCTIONS

SYBASE DB2 REMARKS
============================================

COL_LENGTH - NO EQUIVALENT
COL_SIZE - NO EQUIVALENT
CURUNRESERVEDPGS - NO EQUIVALENT
DATA_PGS - NO EQUIVALENT
DATALENGTH LENGTH CHANGE
DB_ID - NO EQUIVALENT
DB_NAME - NO EQUIVALENT
HOST_ID - NO EQUIVALENT
HOST_NAME - NO EQUIVALENT
INDEX_COL - NO EQUIVQLENT
ISNULL COALESCE NO CHANGE
ICT_ADMIN - NO EQUIVALENT
OBJECT_ID - NO EQUIVALENT
OBJECT_NAME - NO EQUIVALENT
PTN_DATA_PGS - NO EQUIVALENT
RESERVED_PGS - NO EQUIVALENT
ROWCNT - NO EQUIVALENT
SUSER_ID - NO EQUIVALENT
SUSER_NAME CURRENT USER CHANGE
TSEQUAL - NO EQUIVALENT
USED_PGS - NO EQUIVALENT
USER CURRENT USER CHANGE
USER_ID - NO EQUIVALENT
USER_NAME CURRENT USER CHANGE
VALID_NAME - NO EQUIVALENT
VALID_USER - NO EQUIVALENT

TEXT FUNCTIONS

SYBASE DB2 REMARKS
============================================

TEXTPTR - NO EQUIVALENT
TEXTVALID - NO EQUIVALENT

CONVERSION FUNCTIONS

SYBASE DB2 REMARKS
============================================
CONVERT PC CHANGE
HEXTOINT - NO EQUIVALENT
INTTOHEX HEX PARTIALLY EQUIVALENT 3

DATE FUNCTIONS

SYBASE DB2 REMARKS
============================================
DATEADD - DATE ARITHMETIC CAN BE USED
DATEDIFF - DATE ARITHMETIC CAN BE USED
DATENAME - DATE ARITHMETIC CAN BE USED
DATEPART - DATE ARITHMETIC CAN BE USED
GETDATE CURRENT TIMESTAMP CHANGE
SECURITY FUNCTIONS

SYBASE DB2 REMARKS
============================================
IS_SEC_SERVICE_ON - NO EQUIVALENT
MUT_EXCL_ROLES - NO EQUIVALENT
PROC_ROLE - NO EQUIVALENT
ROLE_CONTAIN - NO EQUIVALENT
ROLE_ID - NO EQUIVALENT
ROLE_NAME - NO EQUIVALENT
SHOW_ROLE - NO EQUIVALENT
SHOW_SEC_SERVICES - NO EQUIVALENT


1. IN DB2 POSSTR IS A FUNCTION WHICH TAKES TWO ARGUMENTS POSSTR(
SOURCE_STRING EXPRESSION , SEARCH_STRING EXPRESSION) AND RETURNS AN
INTEGER WHICH DENOTES THE FIRST OCCURRENCE OF THE SEARCH STRING. IT
CAN BE USED FOR BOTH CHARINDEX AND PATINDEX FUNCTIONS OF SYBASE.

NOTE THAT IN DB2 , IN THE FUNCTION LOCATE THE STARTING POINT OF THE
SEARCH FROM WHERE THE SEARCH HAS TO BEGIN CAN ALSO SENT AS AN OPTIONAL
PARAMETER
LOCATE('I','POINT SOLUTION'[,6])

2. IN SYB THE FUNCTION STR TAKES THREE ARGUMENTS
STR(APP_NUM[,LENGTH[,DECIMAL]]) WHERE APP_NUM IS A FLOAT, REAL OR A
DOUBLE PRECISION NUMBER, LENGTH IS THE LENGTH OF THE DECIMAL PART AND
DECIMAL DENOTES THE LENGTH OF THE FRACTIONAL PART. BUT IN DB2 THE
FUNCTION CHAR(IN THIS CONTEXT) TAKES TWO ARGUMENTS CHAR( EXP, DECIMAL
CHAR) WHERE EXP IS AN EXPRESSION THAT RESULTS IN A DECIMAL NUMBER OR
A FLOATING POINT NUMBER AND DECIMAL CHAR IS THE CHARACTER THAT
DENOTES THE CHARACTER USED AS A DECIMAL POINT.

3. IN DB2 THE FUNCTION HEX CAN TAKE ANY BUILT I N DATATYPE AS ARGUMENT.
IN THIS CONTEXT WE CAN GIVE INTEGER EXPRESSION.

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
db*****@gmail.com wrote:
All,

We have listed out the INBUILT Function differences between Sybase and
DB2.

Kindly provide your feedback or corrections and for CHANGES - DO WE
NEED TO CODE our own UDFs?

If you download the migration tool kit (MTK):
http://www-306.ibm.com/software/data/db2/migration/mtk/
it will come with a library of SQL and Java functions and I believe now
with source code for matching C UDF (C UDF are a lot faster).

If teh only difference between sybase and DB2 is the name you can use so
called "sourced" functions (function synonyms).
For fucntions that just provide a constant (PI) or are simple
expressions I recommend using SQL Functions.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.