Viewing 15 posts - 346 through 360 (of 582 total)
I wouldn't recommend using NOLOCK, but certainly locking might fit the outline of the problem. Finish diagnostics then look at the solution.
June 2, 2006 at 5:14 pm
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...
June 2, 2006 at 12:17 pm
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:
June 2, 2006 at 11:28 am
It's a bit inelegant but you can use a hash value to avoid problems with duplicate dates.
a.*
June 2, 2006 at 11:03 am
PW you assume dates are unique within a group. Not a very safe assumption, esp. if there's no time portion, or frequent transactions.
June 2, 2006 at 10:52 am
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...
June 2, 2006 at 10:49 am
Agreed. Applies to all other identifiers as well as table and column names.
June 2, 2006 at 10:13 am
I don't think it will work. Look at the syntax in BOL:
< generation_term > ::=
FORMSOF ( { INFLECTIONAL | THESAURUS } , < simple_term > [ ,...n ] )...
June 2, 2006 at 10:11 am
What datatype is the field? Text or a character datatype? Charindex doesn't work on text.
June 2, 2006 at 10:01 am
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.]
June 2, 2006 at 9:58 am
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...
June 2, 2006 at 9:48 am
that way you don't need to reverse three times to do it...
June 2, 2006 at 9:45 am
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...
June 2, 2006 at 9:35 am
Yes with small recordsets the impact of inefficient code can be negligable.
June 2, 2006 at 9:14 am
Viewing 15 posts - 346 through 360 (of 582 total)