473,806 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

T Sql code for Access Update query

Hi All,
I'm looking for help with what the Transact SQL code is for this
Access Update query sql code. I've been doing Access for some time and
all my back-ends have been jet. I'm just starting with SQLServer back-
ends and I'm wanting to change those queries that can be changed to
pass-thru queries using T SQL were I can.

UPDATE tblHospLineFina l INNER JOIN tblCodes ON
tblHospLineFina l.RemarkCode = tblCodes.CodeID SET
tblHospLineFina l.RemarkDescrip t = tblCodes!CodeDe scription;

thanks
bobh.

Nov 5 '07 #1
6 2639
Try something like this:
Update tbl1 set fname = t2.fname from tbl1 t1 join tbl2 t2 on t1.recID =
t2.recID where t1.fname is null

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 5 '07 #2
On Nov 5, 10:18 am, bobh <vulca...@yahoo .comwrote:
Hi All,
I'm looking for help with what the Transact SQL code is for this
Access Update query sql code. I've been doing Access for some time and
all my back-ends have been jet. I'm just starting with SQLServer back-
ends and I'm wanting to change those queries that can be changed to
pass-thru queries using T SQL were I can.

UPDATE tblHospLineFina l INNER JOIN tblCodes ON
tblHospLineFina l.RemarkCode = tblCodes.CodeID SET
tblHospLineFina l.RemarkDescrip t = tblCodes!CodeDe scription;

thanks
bobh.
You can also search for the UPDATE statement with SQL Server
Management Studio help. It will give you information and examples on
how to use the keyword or statement you desire to implement.
Nov 5 '07 #3
On Nov 5, 2:52 pm, Technolust <queenskni...@t echnologist.com wrote:
On Nov 5, 10:18 am, bobh <vulca...@yahoo .comwrote:
Hi All,
I'm looking for help with what the Transact SQL code is for this
Access Update query sql code. I've been doing Access for some time and
all my back-ends have been jet. I'm just starting with SQLServer back-
ends and I'm wanting to change those queries that can be changed to
pass-thru queries using T SQL were I can.
UPDATE tblHospLineFina l INNER JOIN tblCodes ON
tblHospLineFina l.RemarkCode = tblCodes.CodeID SET
tblHospLineFina l.RemarkDescrip t = tblCodes!CodeDe scription;
thanks
bobh.

You can also search for the UPDATE statement with SQL Server
Management Studio help. It will give you information and examples on
how to use the keyword or statement you desire to implement.
Unforutenaly the company I work in will not allow such management
tools to be purchased and installed on pc's...... :( If I requested
that I'd have to give my right arm and left leg plus my first born and
then it would take about six months before I saw anything and they
would Zen it down to my pc and it would not work, most likely. I don't
what to give up that much nor can I wait that long.

do you know what the T SQL code would be?

Nov 5 '07 #4
Using ADO you can do this (make sure you have a reference to Microsoft
ActiveX Data Object 2.5 Library -- or greater):

Dim cmd As New ADODB.Command, strSql As String

cmd.ActiveConne ction = "Provider=SQLOL EDB; Data
Source=yourServ er;Database=you rDB;Trusted_Con nection=Yes"

cmd.ActiveConne ction.CursorLoc ation = adUseClient

cmd.CommandType = adCmdText

'--this is the Tsql version of your Access update query
strSql = "UPDATE tblHospLineFina l SET
t1.RemarkDescri pt = t2.CodeDescript ion
FROM tblHospLineFina l t1 JOIN tblCodes t2 ON t1.RemarkCode = t2.CodeID"

cmd.CommandText = strsql
cmd.Execute

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 5 '07 #5
On Nov 5, 2:52 pm, Technolust <queenskni...@t echnologist.com wrote:
On Nov 5, 10:18 am, bobh <vulca...@yahoo .comwrote:
Hi All,
I'm looking for help with what the Transact SQL code is for this
Access Update query sql code. I've been doing Access for some time and
all my back-ends have been jet. I'm just starting with SQLServer back-
ends and I'm wanting to change those queries that can be changed to
pass-thru queries using T SQL were I can.
UPDATE tblHospLineFina l INNER JOIN tblCodes ON
tblHospLineFina l.RemarkCode = tblCodes.CodeID SET
tblHospLineFina l.RemarkDescrip t = tblCodes!CodeDe scription;
thanks
bobh.

You can also search for the UPDATE statement with SQL Server
Management Studio help. It will give you information and examples on
how to use the keyword or statement you desire to implement.
I would not do this as I always have the Code Description available by
executing a JOIN. In most cases it's unnecessary to store it twice.
Some would say, "Unwise".

But if in another life I came back as someone less rigorous I would
create a persistent VIEW
eg.
View_1:
SELECT dbo.ExpensesAcc ounts.CommonNam e,
dbo.ExpensesTra nsactions.Debit AccountName
FROM dbo.ExpensesAcc ounts
INNER JOIN dbo.ExpensesTra nsactions
ON dbo.ExpensesAcc ounts.AccountID =
dbo.ExpensesTra nsactions.Debit AccountID

To Update the DebitAccountNam e in ExpensesTransac tions I would just
run a simple Update
UPDATE View1 SET DebitAccountNam e = CommonName

In MS-SqlServer this should update the ExpensesTransac tions Table.

Nov 5 '07 #6
On Nov 5, 1:18 pm, bobh <vulca...@yahoo .comwrote:
Hi All,
I'm looking for help with what the Transact SQL code is for this
Access Update query sql code. I've been doing Access for some time and
all my back-ends have been jet. I'm just starting with SQLServer back-
ends and I'm wanting to change those queries that can be changed to
pass-thru queries using T SQL were I can.

UPDATE tblHospLineFina l INNER JOIN tblCodes ON
tblHospLineFina l.RemarkCode = tblCodes.CodeID SET
tblHospLineFina l.RemarkDescrip t = tblCodes!CodeDe scription;

thanksbobh.
for anyone who's interested this is what worked

UPDATE tblHospLineFina l
SET tblHospLineFina l.RemarkDescrip t = tblCodes.CodeDe scription
from tblHospLineFina l, tblCodes where tblHospLineFina l.RemarkCode =
tblCodes.CodeID

bobh.

Nov 8 '07 #7

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

Similar topics

6
2225
by: David Shorthouse | last post by:
Hello folks, I have a problem with an update query on an asp not updating the table in an Access db. The code runs, I have no errors, but when I examine the table, nothing was updated. The query works as it should in Access. Could anyone direct me to some sources that describe solutions to what is likely a common problem? The strange thing is, I have another update query for a different db on an asp that works just great. Is there...
1
1681
by: Wayne | last post by:
I've created a form that has many option boxes to help users choose items (I need option boxes vs. combo boxes because they can choose multiple items per category). I've created an update query to change the value from –1 (system automatically generates that) to the actual value I want. In the criteria section of the append query, I put a simple if statement: IIf("-1","London",""). Regardless of the value that is found however, the...
1
4783
by: New Guy | last post by:
Could someone please show me how to write an update to: Set the daily.Expense field to the total of the transactions.amount field where transDate = #07/05/04#? I have tried this with the query builder or wizard and it says my query doesn't use a field named "Expense". This is true because I'm using the field named "amount" from the detail table. I'm a bit (a lot) stymied by this.
1
2213
by: csgraham74 | last post by:
Hi Guys, I was wondering if someone could help me with an access query. I basicallly have two tables A & B Im table A there are numerous records with Fields1 & fields 2 I want to use table B to update table A. Bascically i need to compare table A & Table B - if records exist in Table B that are not in Table A
5
3244
by: abhilashcashok | last post by:
hi guys, my prblem is that I cannot update sql query against MS ACCESS using C#. Everytime wen i do so, i got an exception (at runtime) as 'UPDATE syntax not correct'. I don find any error in my 'update' syntax. I can successfully run other dbase operations like insertion, deletion & all.; except Updation. But, i can successfully run the same update query in the 'sql query tab' of MS ACCESS, and is executed successfully.
1
1496
by: tmoon3 | last post by:
Hi, I have an Access DB that tracks employee training. There are about 100 different training columns and I was given a list of employees (and employee id's prinmary key) that have completed First Aid training. Besides exporting the data into excel then doing a vlookup on the SSN's to get the completed training dates for First Aid Then re-importing all of the data back into my Access DB, is there a way that I can have a VBA script or VB...
5
2065
by: teddysnips | last post by:
Having upsized my client's back-end DB to SQL Server, the following query does not work ("Operation must use an updateable query"). UPDATE tblbookings INNER JOIN tblREFUNDS ON tblbookings.TransFromID = tblREFUNDS.BookingID SET tblREFUNDS. = tblbookings! bookingid WHERE (((tblREFUNDS.)=0) AND ((tblbookings.TransFromID) Is Not Null)); I tried rewriting it as follows, with the same problem:
2
1501
by: arvarunar | last post by:
I have two tables: TrendMaster: EmployeeID, Joined_Period, Delay, Index, Branch, K *Joined_period takes month eg: "April", "March"... TrendSheet: Branch, April_Joined, April_Delay, April_Index, May_Joined...so on till March_Delay, March_Index I need to update April_Index with: Average of K factor of employees in TrendMaster for whome Joined_period is April-09 and these need to be grouped as TrendMaster.Branch=TrendSheet.Branch
1
3147
by: giovannino | last post by:
Dear all, I did a query which update a sequence number (column NR_SEQUENZA) in a table using a nice code (from Trevor !). 1) Given that I'm not a programmer I can't understand why numbering doesn't start always, running more times the update query, from the same starting parameter assigned (1000000000). It seems to me that it takes memory last number calculated and running prox update it starts from last table row updated. I need...
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10369
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10372
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.