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

Help- Migrating timestamp from Sybase to DB2

P: n/a
Greetings,
In Sybase, a timestamp column is automatically loaded
by the DB engine and its in some hex format. This is shown below

id timestamp_value
----------- ------------------
1 0x0000000000001031
1 0x0000000000001046

when i try to load this timestamp data into DB2 timestamp column, it
gives me incorrect format for the datetime value.
I know this hex value is giving me problem. From the Sybase, the
timestamp field always yields data into hex fields only.
I just want to know any workaround where i can import or load this hex
timestamp data into db2 timestamp column without any error?

Any help will be appreciated

TIA

Dec 9 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a


pa***************@yahoo.co.in wrote:
Greetings,
In Sybase, a timestamp column is automatically loaded
by the DB engine and its in some hex format. This is shown below

id timestamp_value
----------- ------------------
1 0x0000000000001031
1 0x0000000000001046

when i try to load this timestamp data into DB2 timestamp column, it
gives me incorrect format for the datetime value.
I know this hex value is giving me problem. From the Sybase, the
timestamp field always yields data into hex fields only.
I just want to know any workaround where i can import or load this hex
timestamp data into db2 timestamp column without any error?

Any help will be appreciated

TIA


Sybase's timestamp column has nothing to do with human times and dates.
The Sybase DATETIME column type is for that. A Sybase timestamp column
is for OPTIMISTIC LOCKING, so you can read a row without locking it,
and later do a transaction that says 'WHERE timestampcol = XXX' (XXX is
the value you read before). This will only update the row if some other
transaction has not altered it since you read it.
That's the purpose. If your application uses that column, you will have
to do some deeper understanding of your application, and likely have
to alter it's SQL and/or augment DB2 to implement this sort of behavior.

Joe Weinstein at BEA

Dec 9 '05 #2

P: n/a
Joe Weinstein wrote:


pa***************@yahoo.co.in wrote:
Greetings,
In Sybase, a timestamp column is automatically loaded
by the DB engine and its in some hex format. This is shown below

id timestamp_value
----------- ------------------
1 0x0000000000001031
1 0x0000000000001046

when i try to load this timestamp data into DB2 timestamp column, it
gives me incorrect format for the datetime value.
I know this hex value is giving me problem. From the Sybase, the
timestamp field always yields data into hex fields only.
I just want to know any workaround where i can import or load this hex
timestamp data into db2 timestamp column without any error?

Any help will be appreciated

TIA

Sybase's timestamp column has nothing to do with human times and dates.
The Sybase DATETIME column type is for that. A Sybase timestamp column
is for OPTIMISTIC LOCKING, so you can read a row without locking it,
and later do a transaction that says 'WHERE timestampcol = XXX' (XXX is
the value you read before). This will only update the row if some other
transaction has not altered it since you read it.
That's the purpose. If your application uses that column, you will have
to do some deeper understanding of your application, and likely have
to alter it's SQL and/or augment DB2 to implement this sort of behavior.

Joe Weinstein at BEA

Ah.... In that case I propose an IDENTITY column in conjuction with a
BEFORE UPDATE trigger. a SET versionid = DEFAULT; on the identity column
will force re-issuance.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Dec 10 '05 #3

P: n/a
thnx for the replies.
Joe, i didnt quite get u. i mean if we have a column with that data
type and
we want to migrate it, how exactly should i do it.
i mean can u ellaborate on that with some example.

TIA

Dec 10 '05 #4

P: n/a


pa***************@yahoo.co.in wrote:
thnx for the replies.
Joe, i didnt quite get u. i mean if we have a column with that data
type and
we want to migrate it, how exactly should i do it.
i mean can u ellaborate on that with some example.

TIA


Serge posted a way to do the DBMS-side implementation, but it seems
you have the job of porting an application from one DBMS to another,
and that is much more complicated a task than simply creating tables.
You fundamentally have to understand how your application is using
the Sybase timestamp column (and likely many other design semantics)
before you have a hope of a successful performant conversion.
The DBMS is never a simple row store in any performant application,
and what works well in one DBMS type works differently or not at all
in another.
Joe Weinstein at BEA Systems

Dec 10 '05 #5

P: n/a
thanx.

Dec 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.