Increment a value and return the value using sql

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to combine 2 sql commands:

UPDATE Test SET Test.Counter = [Test].[Counter]+1 WHERE [test].[id]=1;
Select Text.Counter where [test].[id]=1

in one dynamic sql statement.
n.b. i can't use the autocounter.

Is this possible
 
Not in Jet SQL, no. You could do it with VBA, of course.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Tnx for your answer brendan.


Brendan Reynolds said:
Not in Jet SQL, no. You could do it with VBA, of course.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Rob Willaar said:
I need to combine 2 sql commands:

UPDATE Test SET Test.Counter = [Test].[Counter]+1 WHERE [test].[id]=1;
Select Text.Counter where [test].[id]=1

in one dynamic sql statement.
n.b. i can't use the autocounter.

Is this possible
 
Back
Top