473,406 Members | 2,259 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,406 software developers and data experts.

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 tblHospLineFinal INNER JOIN tblCodes ON
tblHospLineFinal.RemarkCode = tblCodes.CodeID SET
tblHospLineFinal.RemarkDescript = tblCodes!CodeDescription;

thanks
bobh.

Nov 5 '07 #1
6 2623
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 tblHospLineFinal INNER JOIN tblCodes ON
tblHospLineFinal.RemarkCode = tblCodes.CodeID SET
tblHospLineFinal.RemarkDescript = tblCodes!CodeDescription;

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...@technologist.comwrote:
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 tblHospLineFinal INNER JOIN tblCodes ON
tblHospLineFinal.RemarkCode = tblCodes.CodeID SET
tblHospLineFinal.RemarkDescript = tblCodes!CodeDescription;
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.ActiveConnection = "Provider=SQLOLEDB; Data
Source=yourServer;Database=yourDB;Trusted_Connecti on=Yes"

cmd.ActiveConnection.CursorLocation = adUseClient

cmd.CommandType = adCmdText

'--this is the Tsql version of your Access update query
strSql = "UPDATE tblHospLineFinal SET
t1.RemarkDescript = t2.CodeDescription
FROM tblHospLineFinal 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...@technologist.comwrote:
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 tblHospLineFinal INNER JOIN tblCodes ON
tblHospLineFinal.RemarkCode = tblCodes.CodeID SET
tblHospLineFinal.RemarkDescript = tblCodes!CodeDescription;
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.ExpensesAccounts.CommonName,
dbo.ExpensesTransactions.DebitAccountName
FROM dbo.ExpensesAccounts
INNER JOIN dbo.ExpensesTransactions
ON dbo.ExpensesAccounts.AccountID =
dbo.ExpensesTransactions.DebitAccountID

To Update the DebitAccountName in ExpensesTransactions I would just
run a simple Update
UPDATE View1 SET DebitAccountName = CommonName

In MS-SqlServer this should update the ExpensesTransactions 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 tblHospLineFinal INNER JOIN tblCodes ON
tblHospLineFinal.RemarkCode = tblCodes.CodeID SET
tblHospLineFinal.RemarkDescript = tblCodes!CodeDescription;

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

UPDATE tblHospLineFinal
SET tblHospLineFinal.RemarkDescript = tblCodes.CodeDescription
from tblHospLineFinal, tblCodes where tblHospLineFinal.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
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...
1
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...
1
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...
1
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...
5
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...
1
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...
5
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...
2
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,...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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...
0
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...

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.