Comparing Time(7) in SQL server

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
phanikumar
Participant
Posts: 60
Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA

Comparing Time(7) in SQL server

Post by phanikumar »

Hi,

I have a scenario where I need to compare time datatype from Datastage to Time(7) in SQL server in my update query.

Upon running below is the error message I get

The data types time and datetime2 are incompatible in the is operator

ODBC function is reading Time(7) as DateTime2 data type which is not able to compare against Time from DataStage.

any thoughts on how to achieve this?

Regards
Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What kind of 'comparison' are you attempting? I would imagine you could convert both the strings in a common format and then compare those.
-craig

"You can never have too many knives" -- Logan Nine Fingers
phanikumar
Participant
Posts: 60
Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA

Post by phanikumar »

Time(7) in SQL Server is DateTime2.

When comparing Time from Datastage to DateTime2 in SQL server it's issuing a error message as mismatch in Datatypes.

We then agreed to change the datatype in the target SQL Server to DateTime which is equivalent to TimeStamp in DataStage.

We are now able to compare TimeStamp in DataStage as against to DateTime in Sql Server.

Finally managed to fix the issue by changing the datatypes.

Regards
Kumar
Post Reply