.NET application to support Oracle & SQL Server

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
LVL 5
MohitPanditAsked:
Who is Participating?
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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.
0
 
Éric MoreauSenior .Net ConsultantCommented:
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.
0
 
Pawan KumarDatabase ExpertCommented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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.
0
 
Pawan KumarDatabase ExpertCommented:
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

0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
0
 
Pawan KumarDatabase ExpertCommented:
Yes thats what. The one one is so used to SQL Server syntax will face issues like me :)
0
 
MohitPanditAuthor Commented:
Thanks for your comments & suggestions. I'll get back.
0
 
MohitPanditAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.