Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.

Jason Rushton

Member since Dec 11, 2008

Recent Blog Comments By Jason Rushton

  • Getting @@RowCount After SQL INSERT INTO Statement

    Posted on Nov 28, 2007 at 5:39 PM

    Triggers are the big thing that can give you problems. If your insert initiated a trigger which did it's own insert, using @@IDENTITY would give you the identity for the triggers insert. Scope_Identity() would give you the identity you were probably expecting.... read more »

  • Getting @@RowCount After SQL INSERT INTO Statement

    Posted on Nov 28, 2007 at 5:02 PM

    Christoph: Just a note, but you should really use SCOPE_IDENTITY() rather than @@IDENTITY, because you can run into conditions where you get an ID you're not expecting otherwise.... read more »

  • Getting Only The Date Part Of A Date/Time Stamp in SQL Server (Revisited)

    Posted on Sep 21, 2007 at 11:47 AM

    We do have a function for doing this. However, from just testing it in a group by for the year, involving around 300,000 records, the inline version is about 4x faster. We use the function for param sets, and in the select clause, but if we're at all concerned about speed, we avoid functions if at... read more »

  • Getting Only The Date Part Of A Date/Time Stamp in SQL Server (Revisited)

    Posted on Sep 21, 2007 at 11:09 AM

    We use the convert Char(10) method here too. CONVERT( DateTime, CONVERT( Char(10), ci_importDate, 101 ) ) I benchmarked the different methods in our database hoping yours might be faster, because we use it for date grouping A LOT for our in house reporting. Every thing I run shows the two you post... read more »