Forum Replies Created

Viewing 15 posts - 4,951 through 4,965 (of 6,036 total)

  • RE: Need a count for each record

    SELECT C.Chg_code , SUM(R.Amount) as Chg_Amount, COUNT(R.Amount) AS Chg_Count

    FROM dbo.ChargeCodesTable C

    INNER JOIN dbo.ChargeRecords R ON C.Chg_code = R.Chg_code

    GROUP BY C.Chg_code

     

  • RE: Finding duplicates in a table.

    SELECT RecID

    FROM Customer A

    WHERE TypeID = 'A'

    AND EXISTS(select 1 from Customer B

    where B.CustID = A.CustID AND B.TypeID <> A.TypeId)

     

  • RE: Log file

    Did you notice, it's not them who limited size of their log file.

    It just reached the end of hard drive. Nowhere to go anyore.

    And you were right, it's BOOOOMMM!!!!

  • RE: dynamic sql

    If it would not be related I would not ask.

    If you would read topic in BOL about Temporary Tables you would not say my question is not related.

  • RE: dynamic sql

    Where do you create and populate #Temp?

    Read about scope of # tables in BOL.

  • RE: Log file

    And those cross joins must be inside of cursors, right?

  • RE: Log file

    Cursors, cross joins, bad table design, dozen of other reasons.

    BTW, simple applications give most terrible load on database.

  • RE: Pass a value to a trigger...

    I think you must log activity related to SP FROM SP.

    And that's the place where you may record the value of your supplied parameter.

    If you want to log activity related...

  • RE: Pass a value to a trigger...

    You probably don't understand my point.

    Tomorrow the guy sitting next to you will manually correct data in the table from EM.

    What will happen to your trigger?

    What user name will be...

  • RE: Pass a value to a trigger...

    You may use temp table. It gonna be accessible from trigger.

    SELECT @username as WinUser

    INTO #CurrentUser

    But that's not a way.

    Are you sure the table you are trying to audit will be...

  • RE: Collation Conflict Error

    Oh, no...

    Everything is even worse!

    NEVER JOIN ON DIFFERENT DATATYPE COLUMNS!

    It means implicit conversion and full table scan on every query!

    Than, replace IN with INNER JOIN.

    Your subquery will effectively create...

  • RE: How to do a Select xx from

    Would you mind to look around a little?

    There is an answer on your question on the 1st page of this forum and couple of answers on the second page.

    Happy browsing.

  • RE: Store Procedure - Return to ASP using parameters NULL

    OK,

    3) Don't ever use VALUES.

    SELECT will do the same but it's more capable and more flexible.

    In your case it allows to use WHERE NOT EXISTS.

    It also allows to...

  • RE: Count Decimal Places

    No, it's actually much worse.

    I tested my function against 16540 row table.

    It returned result in 3..5 seconds (I'm not alone on that server )

    Than...

  • RE: Collation Conflict Error

    ....

    INNER JOIN products p on o.SKU COLLATE Latin1_General_CI_AS  = p.idProduct COLLATE Latin1_General_CI_AS  

    BTW, don't use char values as ID's. There are int's for your service.

    They must have told you about it, but...

Viewing 15 posts - 4,951 through 4,965 (of 6,036 total)