Group:  Microsoft Access ยป microsoft.public.access.odbcclientsvr
Thread: get @@identity

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

get @@identity
"Everaldo Ricardo" <etc_ricardo[ at ]hotmail.com> 01.08.2006 20:05:39
Using msAccess 97 and a Pass-through query I can Insert in a ms-sql server
table, but I don't know how to get the identity

Everaldo Ricardo


Re: get @@identity
Stefan Hoffmann <stefan.hoffmann[ at ]explido.de> 02.08.2006 08:12:46
hi,

Everaldo Ricardo write:
[Quoted Text]
> Using msAccess 97 and a Pass-through query I can Insert in a ms-sql server
> table, but I don't know how to get the identity
Use a SQL batch in your passthrough:

SET NOCOUNT ON;
INSERT INTO dbo.ttype(val, idl) VALUES (123,123);
SELECT SCOPE_IDENTITY();

The SET NOCOUNT is necessary to get only one result set.

The SCOPE_IDENTITY() functions returns the identity used in your insert
table.
[ at ][ at ]IDENTITY will return the last used identity. When your insert triggers
an insert into another table, you will get the identity of the other table.

mfG
--> stefan <--

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net