How do I use SQL Server functions in a pass through query

G

GLI

How do I get an update pass through query to return the
number of records it updated


Here is the query:


SET ARITHABORT ON

UPDATE tbl1 SET tbl1.field_1 = 111 , tbl1.field_2 = 100

FROM tbl1
LEFT JOIN tbl2 ON (tbl1.field_3 = tbl2.field_3)

WHERE tbl1.field_4 = 2004
AND tbl1.field_4 is not null
AND tbl2.field_4 = 'CA'
;

I have played with the SQL Server's @@ROWCOUNT function
but was
unable to get the value displayed on the screen.

I would like this to work with out the intervension of
VBA as
I need to use several of these quick little edits to
various tables in our SQL DB.

Access will return the updated record count if I link to
the tables but I want to
use a pass through query.

Thanks,
GLI
 
P

Pieter Wijnen

in dao
dim db as dao.database
db.execute <yoursql>
debug.print db.recordsaffected

hth

Pieter
 
G

GLI

Thank you for the help.
I was afraid that I would not be able to do this with out
using VBA.

Thanks Again,

GLI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top