SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 datediff T-SQL vs. DB2 sql
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shuda
Starting Member

1 Posts

Posted - 08/03/2005 :  14:33:59  Show Profile  Reply with Quote
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

United Kingdom
22191 Posts

Posted - 08/03/2005 :  16:08:29  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000