Forum Replies Created

Viewing 15 posts - 1 through 15 (of 15 total)

  • RE: Query to get rows where a value must occur X number of times in a row

    Thank you!

    Always nice to know that a problem actually has a name =)

    Your example worked great.

    What if I only would like to select those personIds which has the last...

  • RE: Query to get rows where a value must occur X number of times in a row

    Ahh sorry didnt think about that.

    The "real" table has an identity primary key. I've updated the example code to include a identity key column to use for ordering.

  • RE: Query to get rows where a value must occur X number of times in a row

    I guess the result will group by personId so i only need the personId selected and in the test data only personId=1 meets the requirements of three activityid=2 in-a-row.

    (I need...

  • RE: Query to get rows where a value must occur X number of times in a row

    The result only need to contain the personId. I am only interested to get those personid which has 3 equal acitivyid in a row per person.

    Given a person has the...

  • RE: Dublicate key

    In my opinion error handling shouldn't be handled within an sp/query/method. Catching all exceptions can suppress other important errors which we wouldn't know about if we just return some default...

  • RE: Dublicate key

    I could but I wont =)

    I'am not a big fan of exception driven code/queries.

  • RE: Dublicate key

    That is correct

  • RE: Dublicate key

    Hi!

    Yep its a .net application.

    I'am not checking for existing records before inserting. I guessed it would be faster to just do a check-insert than first a check from application and...

  • RE: Dublicate key

    Nice and simple.

    Is that _the_ way to do check-inserts? I've read many posts on check-inserts, everyone seems to have their own way to do them.

  • RE: Dublicate key

    Hehe =)

    I don't know why my query would affect data integrity? I thought the db design (keys/constraints) was the integrity.

    I'am just after a fast way to check-insert data without getting...

  • RE: Dublicate key

    Thanks for your reply!

    The table is quite busy and contain 10M+ rows what would be the best for performance?

    When comparing a merge version of the query and my original query...

  • RE: Insert slower than update

    Dev (1/3/2012)


    We have a table "Person" (PersonId int PK for relations) and about 20 additional columns describing the person (Firstname, lastname, email) etc. (The fields can vary depending...

  • RE: Insert slower than update

    Grant Fritchey (1/3/2012)


    chandan_jha18 (1/3/2012)


    Jeff Moden (1/3/2012)


    Dev (1/3/2012)


    chandan_jha18 (1/3/2012)


    Dev (1/3/2012)


    chandan_jha18 (1/3/2012)


    Jeff Moden (1/3/2012)


    Actually, it's "expected" behaviour. An INSERT will "touch" on all indexes. An UPDATE...

  • RE: Insert slower than update

    Dev (1/3/2012)


    I've tried to output the inserted personids into a @table variable and #temptable with no diff in performance.

    It might not be true. How did you measure this...

  • RE: Insert slower than update

    Hi

    The steps are not running in a single transaction. Only step 5&6 run in the same transaction

    Edit: update statistics Person with fullscan had no effect on query plan.

Viewing 15 posts - 1 through 15 (of 15 total)