.NET application to support Oracle & SQL Server

MohitPandit
MohitPandit used Ask the Experts™
on
Hello Folks,

I need to build a .NET Application. Initially, it will support to Oracle and later with SQL Server.
So, once migrate with Oracle to SQL Server for data and db schema. It will be done by migration tool.

But, how about CRUD operation, which should common for Oracle and SQL Server?
Should I use plain sql and run time judge with SQL Server & Oracle client OR maintain two entity model?
Do you have any thoughts & suggestions?

Best Regards,
Mohit Sharma
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Engineer
Distinguished Expert 2017
Commented:
Use ANSI-SQL that will guarantee that any SQL will run in Oracle and SQL Server.
Or since you're developing with .NET, I think you can use LINQ to write common code that will work with SQL Server and Oracle.
Éric MoreauSenior .Net Consultant
Top Expert 2016
Commented:
Unless your app is trivial and really simple and you are not using any special functions in Oracle, there is no magic.

Even tools like Entity Framework needs to generate 2 models.
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016
Commented:
Should I use plain sql and run time judge with SQL Server & Oracle client OR maintain two entity model?
Do you have any thoughts & suggestions?

I will go with the two entity models. Oracle and SQL Server(t-sql) syntaxes are very different specially the update statement.
Vitor MontalvãoIT Engineer
Distinguished Expert 2017

Commented:
Oracle and SQL Server(t-sql) syntaxes are very different specially the update statement.
Really? Do you have examples that states your affirmation? I can't see any difference besides the in-built functions that are specific for each SQL language.
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
Example-

This will not work in Oracle but works really well in SQL Server.

Update x
SET x.c1 = y.c1
FROM table1 x
INNER JOIN table2 y ON x.a = y.a

Open in new window

Vitor MontalvãoIT Engineer
Distinguished Expert 2017

Commented:
Well, that's not ANSI-SQL. In my comment I told that if the author uses ANSI-SQL it won't have issues.
For your example the following will work on both Oracle and SQL Server:
UPDATE table1
SET c1 = (SELECT y.c1
          FROM table2 y
          WHERE table1.a = y.a);

Open in new window


EDIT: Code updated
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
Yes thats what. The one one is so used to SQL Server syntax will face issues like me :)

Author

Commented:
Thanks for your comments & suggestions. I'll get back.

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial