Mark A Matte
markamatte at hotmail.com
Mon Sep 25 13:21:19 CDT 2006
John, I just kinda lurk on the SQL list...just wading through trying to learn...and not sure if this could be a solution for you...but depending on what version of SQL you're using, one of the following may be useful: @@IDENTITY This is an intrinsic variable in SQL Server that contains the Id of the record that was last created on this connection, regardless of the table. IDENT_CURRENT('table') This function returns the ID of the record that was last created in the specified table. SCOPE_IDENTITY This variable contains the Id of the last record that was created within the current scope, regardless of the table. Good luck, Mark A. Matte >From: "John Skolits" <askolits at ot.com> >Reply-To: dba-sqlserver at databaseadvisors.com >To: <dba-sqlserver at databaseadvisors.com> >Subject: Re: [dba-SQLServer] Accees Grouping Vs SQL >Date: Mon, 25 Sep 2006 06:58:38 -0400 > >Thanks for the responses. > >I really need Last since there are three records all with the same date and >I want to take the last one entered. There is no Increment field so no way >of knowing which is the last. With Access, I can be sure I have the right >record, but in SQL, I'm not sure. I wonder how the Access SQL call is >getting converted when it hits SQLServer when using First Or Last. > >I guess I can try to use the SQL tracer? I think that's what it's called, >been a while since I've used it. That might help figure it out. > >Thanks. > >John > > > > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darren >DICK >Sent: Sunday, September 24, 2006 8:27 PM >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Accees Grouping Vs SQL > >Howdy > >Yep they certainly are NOT the same - nor should they be confused as being >the >same - however in the simple demo I gave it should find his first date in a >column on a table > >(remembering I am an SQL Luddite) > > >Many thanks > >Have a great day > >Darren >------------------ >T: 0424 696 433 > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan >Harkins >Sent: Sunday, 24 September 2006 12:19 AM >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Accees Grouping Vs SQL > >You're right -- the results will often be the same. :) But their functions >aren't the same, so, just wanted to warn folks to be careful. > >Susan H. > >They are if you use then on the Order By column :-) > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com >