Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 datediff T-SQL vs. DB2 sql

Author  Topic 

shuda
Starting Member

1 Post

Posted - 2005-08-03 : 14:33:59
This simple datediff works fine on sybase:
SELECT DATEDIFF(d, '01/01/2005', '02/01/2005')

However, when I run the query on a DB2 db. I get this error message:

[IBM][CLI Driver][DB2/6000] SQL0206N "D" is not valid in the context where it is used. SQLSTATE=42703
(42S22,-206)

Question: is there different syntax for datediff in DB2 OR should it be the same T-SQL statement?

Kristen
Test

22859 Posts

Posted - 2005-08-03 : 16:08:29
Welcome to SQL Team shuda!

You're on a bit of a "wing and a prayer" in here 'coz its a SQL Server forum, but I turned up this in Google

http://sqlzoo.net/howto/source/z.dir/tip280853/db2

No idea if its any good, but Google said it had 3,980 hits so that's probably worth a try if this particular link is duff.

Kristen
Go to Top of Page
   

- Advertisement -