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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can we write a standard query, which can run both on MS Access and SQL Server or any

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-08 : 09:12:36
Malik writes "SQL Server
==========
UPDATE AcctBalance SET AcctBalance.AcctType = C_EntityCoA.AcctType, AcctBalance.MainGroup = C_EntityCoA.MainGroup,
AcctBalance.SubGroup = C_EntityCoA.SubGroup, AcctBalance.SpecifySub = C_EntityCoA.SpecifySub, AcctBalance.CarryForward = C_EntityCoA.CarryForward,
AcctBalance.TrustCapInc = C_EntityCoA.TrustCapInc from AcctBalance INNER JOIN C_EntityCoA ON (AcctBalance.EntCode = C_EntityCoA.EntCode) AND
(AcctBalance.AcctCode = C_EntityCoA.AcctCode) WHERE AcctBalance.EntCode = '3434'

MS Access
=========
UPDATE AcctBalance INNER JOIN C_EntityCoA ON (AcctBalance.EntCode = C_EntityCoA.EntCode) AND
(AcctBalance.AcctCode = C_EntityCoA.AcctCode) SET AcctBalance.AcctType = C_EntityCoA.AcctType, AcctBalance.MainGroup = C_EntityCoA.MainGroup,
AcctBalance.SubGroup = C_EntityCoA.SubGroup, AcctBalance.SpecifySub = C_EntityCoA.SpecifySub, AcctBalance.CarryForward = C_EntityCoA.CarryForward,
AcctBalance.TrustCapInc = C_EntityCoA.TrustCapInc
WHERE AcctBalance.EntCode = '3434')"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-08 : 12:10:21
The closer that you follow the ANSI standard, the easier it will be to port the query to another database platform.

Tara
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-04-08 : 12:30:21
You can write each table update as a seperate update instead of using the access format which allows multiple tables to be updated in one UPDATE statement. This seems nice, but it's not the industry standard. If you write each table update seperate it will work in both SQL Server and Access.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -