Viewing 15 posts - 6,556 through 6,570 (of 7,608 total)
When you delete a large or very large numberr of rows at one time, SQL Server defers the actual deletes. The next time a page with deleted r0w(s) is...
May 7, 2013 at 11:45 am
If the numeric portion is random anyway, definitely use all numeric characters if possible -- you're quite right: prefixing the random numbers with a fixed string will NOT help the...
May 6, 2013 at 4:08 pm
jenny 12957 (5/6/2013)
im not sure this is the right forum to put this in, but i am working on redesigning our company database, and i was looking for best practices...
May 6, 2013 at 4:00 pm
Just to clarify: with ROW_NUMBER(), you don't have to ORDER BY all the columns you want to SELECT; just one ORDER BY column is fine if that's all you need....
May 6, 2013 at 3:50 pm
I think this will do it; performance will depend on the indexes available on the table:
select sales.*
from (
select distinct TerritoryID
from [Sales].[SalesOrderHeader]
)...
May 2, 2013 at 12:32 pm
GilaMonster (4/30/2013)
ScottPletcher (4/30/2013)
When rebuilding a nonclustered index offline, SQL has to fully scan the clustered index.
No it doesn't. That would be an inefficient way of running a rebuild. Both online...
April 30, 2013 at 1:18 pm
GilaMonster (4/28/2013)
2) Up to you. Depends on your requirements...
April 30, 2013 at 10:16 am
That could find the wrong entry and/or miss the entry if it was an index on a view instead of a table. Therefore, the code below is more robust:
IF...
April 30, 2013 at 10:03 am
I'd use a CASE expression so you can guarantee the order of execution; you don't need a CTE for that.
SELECT OBSVALUE
FROM OBS
WHERE 1 = CASE
WHEN...
April 26, 2013 at 4:29 pm
Sorry:
SELECT
[values].value,
SUM(CASE WHEN Q1 = [values].value THEN 1 ELSE 0 END) AS Q1,
SUM(CASE WHEN Q2 = [values].value THEN 1 ELSE 0 END) AS Q2,
SUM(CASE WHEN Q3 = [values].value THEN 1 ELSE...
April 25, 2013 at 12:30 pm
SQL_Enthusiast (4/25/2013)
April 25, 2013 at 11:12 am
GilaMonster (4/25/2013)
Abu Dina (4/25/2013)
I bet it's the table variables. They can't have indexes on them nor stats maintained for the data.
Table variables don't have stats, but they certainly can have...
April 25, 2013 at 11:10 am
There's no inherent reason the proc should perform so badly.
Instead of table variables, use temp tables and index the temp tables appropriately.
I suspect the time can be reduced significantly from...
April 25, 2013 at 10:38 am
You may gain some performance by avoiding counting all the rows in inserted and deleted:
ALTER TRIGGER dbo.SystemInfoTrg
ON dbo.SystemInfo
AFTER INSERT, DELETE, UPDATE
AS
SET NOCOUNT ON;
DECLARE...
April 25, 2013 at 10:35 am
I think something like this should at least be close:
SELECT
[values].value,
SUM(CASE WHEN Q1 = [values].value THEN 1 ELSE 0 END) AS Q1,
...
April 25, 2013 at 10:29 am
Viewing 15 posts - 6,556 through 6,570 (of 7,608 total)