Viewing 15 posts - 14,776 through 14,790 (of 14,953 total)
Not an elegant solution, but what happens if you wrap the whole thing in an outer query and select the sum of that column?
January 25, 2008 at 1:54 pm
Just ran some tests.
Mark's solution was much faster than derived tables. Tried it on 50k rows of data. Difference of 14 seconds average (derived tables) vs a maximum...
January 25, 2008 at 12:05 pm
The other thing that's probably hurting the performance is the Distinct operator in the derived tables. That's a lot of extra work for the database engine, but doesn't actually...
January 25, 2008 at 11:38 am
The format is:
SELECT @MyValue= ParameterValue FROM PARAMETERS WHERE ParameterName='AlarmLevel0'
That will assign the value from the table.
January 25, 2008 at 11:29 am
The simplest solution I can think of uses derived tables or CTEs and joins to them. But you said you don't want to do that. Any particular reason...
January 25, 2008 at 11:10 am
checksum doesn't guarantee unique results. It'll probably be unique, but it's not guaranteed. More likely to be unique than Rand() is, though.
January 25, 2008 at 11:03 am
I'm not entirely clear on what you're asking. Please post the code you have a question about (both CTE and the other version), and we can take a look...
January 25, 2008 at 10:41 am
If you don't want to use a Case statement, use:
coalesce(nullif(name, ''), 'Unknown')
The nullif will make the name null if name = ''.
January 25, 2008 at 10:37 am
Try this:
declare @Start_Date datetime, @Weeks int
declare @MaxDate datetime
select @maxdate = dateadd(week, 1, getdate()),
@start_date = dateadd(day, 2, dateadd(day, -1 * datepart(weekday, @start_date), @start_date))
;with Weeks (WStart datetime, WEnd datetime) as
(select dateadd(week, num-1,...
January 25, 2008 at 8:59 am
Rebuild does more than Reorganize. Microsoft recommends rebuilding if fragmentation is over 30%, and reorganizing if fragmentation is between 5% and 30%, and leaving the index alone if fragmentation...
January 25, 2008 at 8:12 am
There isn't an exact solution that I know of. Since a view can't pass parameters to a table-value function, you might have trouble doing this.
If you can use a...
January 25, 2008 at 7:28 am
This is normal behavior in SQL databases.
The first time you run it, it has to come up with an execution plan, so that takes the longest.
After that, the first time...
January 24, 2008 at 3:29 pm
Makes sense. Try running it on the string function, just without the final convert to numeric. That should give you what you need.
Definitely feel for you on that...
January 24, 2008 at 2:08 pm
Add a derived table to the From statement:
From Numbers
cross join
(select distinct sales_owner
from dbo.op_opportunity) SubOwner
Then add "and sales_owner = subowner.sales_owner", to the sub-query.
That should give you what you want.
Note that the...
January 24, 2008 at 2:03 pm
Viewing 15 posts - 14,776 through 14,790 (of 14,953 total)