473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

sql standards

Jo
Do DB2 SQL statements run on MS SQL Server?
What would be the best way to keep one version of the application
source code which would work with both DB2 and SQL Server databases?
rather than maintaining 2 diff. source codes of the same application.
Would appreciate any advice.
Thanks a lot.

Aug 7 '06 #1
5 1627
Jo wrote:
Do DB2 SQL statements run on MS SQL Server?
What would be the best way to keep one version of the application
source code which would work with both DB2 and SQL Server databases?
rather than maintaining 2 diff. source codes of the same application.
Would appreciate any advice.
If your test your SQL Statements on DB2 you'll have a better chance
getting them to work on SQL Server than the other way around. (I assume
you turn all those SQL server knobs like ANSINULL etc on).
The most common troublemakers are violations of the rules for
identifiers. HelloWorld is Capitalized by SQL. "HelloWorld" is not.
There are no exceptions. (no [...] etc, etc...).
DB2 also enforces strong typing as required by the standard.
Again if you start with DB2 you won't get into trouble when porting.

One vendor with whom I have been working recently stores all their SQL
in a common file. Proprietary statements go into exception files.
Seems to work for them. In that case the app was developed on SQL Server
and the DB2 exception file was about 15% the size of the master.

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 7 '06 #2
Jo
Would you suggest the best way to port an application (that works with
MS SQL Server) would be to make the changes to the SQL statements so
that they would work with DB2. And consequently maintain 2 versions of
the application, one for DB2 and one for SQL Server? Is that the normal
way its done out there?
Thanks a lot !

Aug 7 '06 #3
I guess the main issue would be the use of db2 functions (or sql
functions) which are not compatible. For eg the substring function in
db2 is SUBSTR() while in SQL server its SUBSTRING(). Also another
example would be char() in db2 converts a non character value to a
character value (i.e. casts it to char) ..while the same function in
SQL server would try to find the ascii equivalent of the input ..(which
is similar to chr() in db2)..
I guess the approach to take would be to maintain two different
versions of the app..each with its own sql ..

Jo wrote:
Would you suggest the best way to port an application (that works with
MS SQL Server) would be to make the changes to the SQL statements so
that they would work with DB2. And consequently maintain 2 versions of
the application, one for DB2 and one for SQL Server? Is that the normal
way its done out there?
Thanks a lot !
Aug 7 '06 #4
Jo wrote:
Would you suggest the best way to port an application (that works with
MS SQL Server) would be to make the changes to the SQL statements so
that they would work with DB2. And consequently maintain 2 versions of
the application, one for DB2 and one for SQL Server? Is that the normal
way its done out there?
Thanks a lot !
It's not an easy one to answer and depends on teh complexity of your
SQL. Your typical PHP app is simple enough that there existsa shared
SQL92 way that works on both DBMS. So using the DB2 changes as a
feedback (and enforcing the required coding style changes) will save you
in the long run. These are often trivial requirements such as using
ansi-join syntax and the like.
If you app is more compelx (perhaps using triggers, procedures, etc.
then 2 versions is often what you end up with, sadly enough.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 7 '06 #5
For an example of a PHP app that supports multiple databases, look at
"http://sourceforge.net/projects/gallery". It supports PostgreSQL,
MySQL, DB2, Oracle, and SQL Server (at least it will support SQL Server
in the next release, which will hopeffully be in the next few weeks or
month).

The trick is in abstraction. The non-uniform SQL (like
SUBSTR/SUBSTRING) is generated dynamically. In the Gallery2 source
tree, see "modules/core/classes/GalleryStorage/Db2Storage.class",
function "getFunctionSql()". There is an equivalent file for each
supported RDBM.

In addition, Gallery uses another PHP abstraction package called ADOdb,
see "http://sourceforge.net/projects/adodb".
Serge Rielau wrote:
Jo wrote:
Would you suggest the best way to port an application (that works with
MS SQL Server) would be to make the changes to the SQL statements so
that they would work with DB2. And consequently maintain 2 versions of
the application, one for DB2 and one for SQL Server? Is that the normal
way its done out there?
Thanks a lot !
It's not an easy one to answer and depends on teh complexity of your
SQL. Your typical PHP app is simple enough that there existsa shared
SQL92 way that works on both DBMS. So using the DB2 changes as a
feedback (and enforcing the required coding style changes) will save you
in the long run. These are often trivial requirements such as using
ansi-join syntax and the like.
If you app is more compelx (perhaps using triggers, procedures, etc.
then 2 versions is often what you end up with, sadly enough.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MarionEll | last post by:
XML 2003 Interoperability Demonstrations to Showcase Industry Standards, Integrated Vendor Solutions Alexandria, VA – Nov. 19, 2003 – IDEAlliance, a leading trade association dedicated...
162
by: Isaac Grover | last post by:
Hi everyone, Just out of curiosity I recently pointed one of my hand-typed pages at the W3 Validator, and my hand-typed code was just ripped to shreds. Then I pointed some major sites...
4
by: dotNetDave | last post by:
About three weeks ago I released the first .NET coding standards book titled "VSDN Tips & Tricks .NET Coding Standards". Here is what the famous author/ speaker Deborah Kurata says about it: ...
17
by: Ian | last post by:
Hi there, Can anybody tell me where I can find a standards documents like you have in c#. I am trying to write javascript and would like to know what standards are i.e. Where to put the...
23
by: Mario T. Lanza | last post by:
I have been authoring web sites for several years now and recently come to value web standards (as touted by Zeldman and many other web gurus). I have noticed with frustration that there are so...
250
by: Sugapablo | last post by:
Just out of curiosity, while checking on a site I was working on, I decided to throw a couple of the web's most popular URLs into the W3C Markup Validator. Out of microsoft.com, google.com,...
115
by: junky_fellow | last post by:
What is a C object ? If i have some function "func()" in my C program, then can i say that "func()" is a C object ? or if i have some function pointer (ptr) which contains the address of...
9
by: Jason Gogela | last post by:
Does anyone out there know why I should care whether a <span> is nested in a <p> or vice versa? What is the bennafit of adhering to this standard? It seems to me that regardless of which way you...
3
by: editormt | last post by:
A recent poll asked if programming standards are used by development organisations... and if they are controlled. None: 20% Yes, but without control: 49% Yes, with control: 31% Participants:...
53
by: Jim Cook | last post by:
I previously had asked if there was an online standards file so I could read that and answer my own questions without posting here and getting flamed for not having done my homework. I was...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.