Forum Replies Created

Viewing 15 posts - 586 through 600 (of 1,347 total)

  • RE: Where clause not working

    >>Your query to test using UNIONs produces syntax errors:

    Indeed it does. Fix the 3 Case expressions and add the "End" keywords that I forgot:

    Case When m.Customer Is Null Then...

  • RE: Where clause not working

    How about you run this query and post the results.

    It builds a derived table of all the Customer Numbers you're including, then it takes that set and LEFT JOINs it...

  • RE: Redundant indexes?

    >>Are the singlet indexes redundant and unnecessary?  Is there a definitive answer to that question? 

    There is no definitive answer, because it depends on the distribution of data in the table/indexes,...

  • RE: Where clause not working

    Maybe it's time to post some DDL for the tables involved.

    There are 3 tables, each with a customer or customernumber column. Are they the same datatypes ?

     

  • RE: temporary tables

    What is the purpose of the 1st recordset (TempRS), if the SQL that is executed does not return a recordset ?

    Why do you need a #temp table when this can...

  • RE: Where clause not working

    Try removing the blank line betwene your JOIN and WHERE so that SQL knows where the batch ends ?

     

  • RE: Indexing Question

    >>Should this field be indexed in order to maximize performance? 

    Answer is: "it depends".

    Factors to consider:

    - What is the data distribution in the table

    - Will the index be unique or non,...

  • RE: Query Bogged Down, sp_who2 Shows Multiple Rows w/ same SPID

    What you are seeing are multiple threads being spawned to process in parallel.

    You can try providing the MAXDOP query hint to prevent use of paralellism to see if it improves the...

  • RE: Help with a Cursor... yes..

    >>Incorrect syntax near the keyword 'THEN'.

    Why are you puzzled ? The error tells you exactly what is wrong. Incorrect syntax.

    Look up IF in books online, View the example code. The...

  • RE: results of select as variable???

    You can't assign a multi-column result set into a single variable. General syntax is:

    SELECT

      @Var1 = Column1,

      @Var2 = Column2,

      ...

      @VarN = ColumnN

    FROM

    WHERE etc

  • RE: Sum of hours

    So, you have to handle overlapping and non-overlapping periods ?

    Since your granularity is to the minute, I would build a table containing all workable minutes in the day - this would...

  • RE: Sum of hours

    How can 1 person work on 2 physically separate cars at the same time ?

    Is this why I get billed so much for "labor" when I get my car serviced...

  • RE: join question

    For problems like this, you generally need to join to a derived table (note, not a sub-query), where the derived table introduces a column that resolves to just 1 row....

  • RE: DELETE syntax vs. SELECT syntax

    >>DELETE FROM tblAPData AS d

    If using a tablename and alias, you have to explicitly delete from 1 of them before the FROM keyword:

    DELETE d

    FROM tblAPData AS d

    WHERE EXISTS

    (SELECT t.* FROM...

  • RE: Times by quarterhour

    >>I'm curious why you included the test in the JOIN

    2 reasons

    - Code readability/maintainability

    - Performance & index usage

    Maintenance: Consider if there was more than 1 column being filtered on, in...

Viewing 15 posts - 586 through 600 (of 1,347 total)