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.
Author |
Topic |
vasu4us
Posting Yak Master
102 Posts |
Posted - 2008-01-22 : 12:58:17
|
I have a package which establishes connection with DB2 server.I dont have any db2 application where i can format query for db2.This is my query in access/sql.can someone help me converting it into a db2 query.i tryed to google and use the functions but i failed and even the error that ssis gives don't help asthey are same for any type of error.Thanks in ADVSELECT table1.YYYY & table1.MM as MO_YR,table2.CNTRYCD AS CNTRY_CD,Sum(table1.AMT) AS [VALUE]FROM table1 INNER JOIN table2 ON (table1.MM = table2.MM) AND (table1.YYYY = table2.YYYY)WHERE (table1.YYYY BETWEEN YEAR(DATE()) AND YEAR(DATEADD("m",-3,DATE())))AND (table1.MM BETWEEN MONTH(DATE()) AND MONTH(DATEADD("m",-3,DATE())))GROUP BY table2.CNTRYCD, table1.YYYY, table1.MM |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-01-22 : 22:37:59
|
Looked db2 sql manual? |
 |
|
jillo
Starting Member
1 Post |
Posted - 2008-01-30 : 23:02:42
|
quote: Originally posted by vasu4us I have a package which establishes connection with DB2 server.I dont have any db2 application where i can format query for db2.This is my query in access/sql.can someone help me converting it into a db2 query.i tryed to google and use the functions but i failed and even the error that ssis gives don't help asthey are same for any type of error.Thanks in ADVSELECT table1.YYYY & table1.MM as MO_YR,table2.CNTRYCD AS CNTRY_CD,Sum(table1.AMT) AS [VALUE]FROM table1 INNER JOIN table2 ON (table1.MM = table2.MM) AND (table1.YYYY = table2.YYYY)WHERE (table1.YYYY BETWEEN YEAR(DATE()) AND YEAR(DATEADD("m",-3,DATE())))AND (table1.MM BETWEEN MONTH(DATE()) AND MONTH(DATEADD("m",-3,DATE())))GROUP BY table2.CNTRYCD, table1.YYYY, table1.MM
1. Make sure you use the schema name and then the table name eg. schemaA.table1 INNER JOIN schemaA.table22. for any functions within DB2 go to [url]http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/admin/c0000767.htm[/url] |
 |
|
|
|
|
|
|