Forum Replies Created

Viewing 15 posts - 2,866 through 2,880 (of 6,036 total)

  • RE: String function

    khushbu.kumar (9/10/2008)


    Thanks a lot Chris!

    But the here posted code was just a snippet

    i really dont know how many rows can be present(i'm selecting them on the basis of id...

  • RE: COUNT without the INNER JOIN DUPLICATES

    Can you add dbo.tblCards.ID to SELECT to see if those records are actually duplicates?

    If dbo.tblCards.ID will not repeat then they are not.

    Joins don't add duplications.

    Never.

    It's either bad data or...

  • RE: COUNT without the INNER JOIN DUPLICATES

    Why did you decide those 410 records are duplicates?

    In your DISTINCT query you group by PrintDate, CardType.

    So, if they have printed 10 cards of the same type on the same...

  • RE: COUNT without the INNER JOIN DUPLICATES

    If to follow the logic of your query this is what you are trying to get:

    SELECT a.strUserName, Count(A.ID) AS CardsPrinted

    FROM dbo.tblUsers a

    WHERE EXISTS(select 1

    from dbo.tblEvents...

  • RE: SQL Injection Countermeasures

    Try this:

    USE MASTER

    select * from syscolumns

    where name like '%exec%'

    See? Your filter would consider some system calls illegal.

    Don't you have column "IsDeleted" anywhere in your database?

    Many developers like those "flag" columns.

    What...

  • RE: Best Practice

    icocks (9/5/2008)


    A further thing to bear in mind - if there's an Insert trigger on the table, then it will be fired in response to option 2, but not option...

  • RE: Best Practice

    I always use IF EXISTS(select 1 from inserted) or deleted.

    It allows not to run "insert" part of INSERT/UPDATE/DELETE trigger only when there are actually inserted rows.

  • RE: Best Practice

    Both options are identical on cost.

    Both perform same SELECT and both perform INSERT only if SELECT returns no records.

    The only important difference s that 2nd option escalates shared locks applied...

  • RE: Best Practice

    Ric Sierra (9/4/2008)

    Yes.

    I'd like to see how.

    I guess I'm not alone here.

    Yes.

    Same question - how?

    I agree with your POV but both solutions are efective to insert a new record without...

  • RE: Best Practice

    Ric Sierra (9/4/2008)


    I'm not completly agree with the answer, because depends of the context:

    If you are looking for the best execution plan the answer is #1

    Can you prove it?

    Open QA,...

  • RE: Best Practice

    Thanks guys for the feedback.

    davidr (9/4/2008)


    side note: we shouldn't really be doing "select *" to check for existence. If that's a LOONNNNGGGGG row there could be a...

  • RE: populate a weeks worth of data from daily data

    Tomm,

    THe beauty of the solution posted by Michael is it does not depend on DATEFIRST settings.

    Moreover, it allows to set required "datefirst" as a parameter.

    So, what's the point to...

  • RE: Need help to figuer out the issue

    You can add constraint at any time.

    Just be aware - you live application will throw error when trying insert duplicates.

  • RE: Need help to figuer out the issue

    There is the query to identify rows to be deleted.

    Once you see the candidates for deletion are correct - run commented DELETE.

    SELECT T.*

    --DELETE T

    FROM tblprojectmembers T

    INNER JOIN (

    select count(*), MIN(ProjectMemberId)...

  • RE: Need help to figuer out the issue

    Sagar (9/2/2008)


    projectmemberid- pk, projectid = fk not null, projectmemberuserid fk, null.

    projectmemberuserid is equivalent to userid in another tbluser which has all the users. i know there is some...

Viewing 15 posts - 2,866 through 2,880 (of 6,036 total)