November 5, 2008 at 5:32 pm
I have good experience working in SQL Server but now I need to help support an application in DB2. Can anybody recommend a website or book that can help me learn DB2 sql and hopefully show me the T-SQL version and the DB2 version?
Some easy things I took for granted in T-SQL do not work in DB2 like
SELECT TOP 10 * FROM Table
SELECT * FROM Table WHERE Date >= '1/1/2008'
November 6, 2008 at 1:19 am
Mike,
Firstly you have my sympathy. I too got involved in a DB2 project but that's another matter. Back on SQL Server now, phew! As I went along, and to help the other developers who would be joining the project after I had got it up and running, I made notes and created examples of DB2 equivalents of the SQL Server stuff we all know and love. Don't know if you tried writing you're first stored procedure yet but I don't mind saying that the first one I wrote took me about 2 hours to get it to compile.
SELECT TOP 10 * is achieved in DB2 by SELECT * FROM MyTable FETCH FIRST 10 ROWS ONLY. When comparing dates, if the DB2 column is a datetime you must always provide the time portion. Oh, and strings are case sensitive. DB2 doesn't have an equivalent of TRUNCATE TABLE so from the command line you use the load command to load an empty file into you table, e.g. db2 load from empty.del of del replace into . Import can be used as well.
The pain goes on.
Anyway to finally answer your question about a SQL Server to DB2 guide, the following link will take you to a pdf you can download:
http://www.redbooks.ibm.com/redpieces/abstracts/sg246672.html
The best DB2 book comes from IBM Press. Mine is from Version 8 days so there may be a newer version. It is entitled DB2 SQL PL Essential Guide for DB2 UDB on Linux, Unix, Windows etc etc The ISBN is 0-13-147700-5.
Bonne chance, mon ami!
Mike
November 10, 2008 at 5:28 am
IBM publish all the DB2 manuals online. It can be a pain to find them, but Google knows most of the places...
The best practice documentation and research documentation are called Red Books, and the link to these has already been given.
Another good resource is the "DB2 SQL Cookbook", again Google knows the url for this.
SQL Server and DB2 use a very similar dialect of SQL, which can make the differences harder to cope with (unlike Oracle, where you expect differences and get surprised when things are the same as SQL Server).
Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply