Forum Replies Created

Viewing 15 posts - 346 through 360 (of 582 total)

  • RE: Easy and effective way to search?

    What improvements do they want?

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Horrible response time with Update Query

    I wouldn't recommend using NOLOCK, but certainly locking might fit the outline of the problem. Finish diagnostics then look at the solution.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: function call with database as parameter.

    Actually, an afterthought. If you ar enot using this for anything important, you could have a look at the undocumented system proc sp_MSforeachdb, which I think uses dynamic SQL. The...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Why does this take so long?

    Good plan - but I think the OR should be an AND. Shame the date and minutes fields aren't in the same table.

    Here's a couple of alternative versions:

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: select first entry in every set?

    It's a bit inelegant but you can use a hash value to avoid problems with duplicate dates.

    Select

    a.*

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: select first entry in every set?

    PW you assume dates are unique within a group. Not a very safe assumption, esp. if there's no time portion, or frequent transactions.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: select first entry in every set?

    Do you want the earliest of the records, latest, don't care? If you want first or last, how will you break ties? If you don't care which record you keep it...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: HOW DO YOU SELECT TABLES FROM MULITPLE SQL SERVER DATABASES

    Agreed. Applies to all other identifiers as well as table and column names.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Full Text Search

    I don't think it will work. Look at the syntax in BOL:

    < generation_term > ::=

         FORMSOF ( { INFLECTIONAL | THESAURUS } , < simple_term > [ ,...n ] )...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Extracting data using substring and charindex?

    What datatype is the field? Text or a character datatype? Charindex doesn't work on text.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: right of last instance of characters

    Not in TSQL you can't.

    [edit: oh i see it's a UDF. There are better ways of splitting strings though. But this request was not about doing that anyway.]

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Average Cost

    5 most recent sales to whom, of what?

    The (scalar) UDF in a SQL statement acts like a correlated subquery. Just as the subquery is joined on Customer and Item, the...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: right of last instance of characters

    declare @str varchar(8000)
    set @str = 'a:bb:cc:'
    select
    substring(@str,len(@str)-charindex(':',reverse(@str))+2,8000)

     

    that way you don't need to reverse three times to do it...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Average Cost

    Here's one way of doing it in a single SQL statement, but it's fairly messy and essentially the same as the UDF method. Might give the optimiser some scope for improvement over...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Average Cost

    Yes with small recordsets the impact of inefficient code can be negligable.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • Viewing 15 posts - 346 through 360 (of 582 total)