Viewing 15 posts - 16 through 30 (of 56 total)
The following DMV query returns the number of execution for a specific stored procedure since the last server restart:
SELECT execution_count
FROM sys.dm_exec_procedure_stats
WHERE object_id = OBJECT_ID('YourSPNameGoesHere')
If your server is online more than...
___________________________
Do Not Optimize for Exceptions!
April 4, 2014 at 2:54 am
Koen Verbeeck (4/3/2014)
GilaMonster (4/3/2014)
[Why would you do that over making them DURABILITY = SCHEMA_AND_DATA?
I doubt they're the target of heavy changes, so there won't be logging overhead.
Good point.
Yep. Whenever you...
___________________________
Do Not Optimize for Exceptions!
April 3, 2014 at 2:55 am
As with disk tables we would need your CREATE TABLE statement for the memory optimized table to check the table and index definition.
Since the ALTER TABLE statement is not...
___________________________
Do Not Optimize for Exceptions!
April 2, 2014 at 4:19 pm
DECLARE @d AS DATE = '20140101';
INSERT INTO dateLanguage([monthName],monthNameEs,monthNameFr,MonthNamePt)
SELECT
FORMAT(@d, N'MMMM', N'en-us'),
FORMAT(@d, N'MMMM', N'es-es'),
FORMAT(@d, N'MMMM', N'fr-fr'),
FORMAT(@d, N'MMMM', N'pt-pt');
GO
SELECT * FROM dateLanguage;
[font="Courier New"]monthName ...
___________________________
Do Not Optimize for Exceptions!
March 31, 2014 at 1:54 pm
Create and populate sample table:
CREATE TABLE dbo.T1
(
m TINYINT NOT NULL,
val INT NOT NULL
)
GO
INSERT INTO dbo.T1
VALUES(1,2019),(2,2941),(3,2968),(4,1523),(5,1983),(6,2398),
(7,2347),(8,1348),(9,2772),(10,2289),(11,1765),(12,1256)
GO
Here is the query:
SELECT *
FROM dbo.T1
ORDER BY CASE WHEN m < MONTH(GETDATE()) THEN...
___________________________
Do Not Optimize for Exceptions!
March 31, 2014 at 1:42 pm
Your create index statement fails because of syntax error.
This part:
WITH (FillFactor = 100)
WITH DROP_EXISTING
needs to be rewritten to:
WITH
(
FILLFACTOR = 100,
DROP_EXISTING = ON
)
With so corrected syntax your statement still can...
___________________________
Do Not Optimize for Exceptions!
March 23, 2014 at 2:40 am
Do you use fully qualified names? i.e. SELECT cols FROM dbo.Table1 instead of SELECT cols FROM Table1?
___________________________
Do Not Optimize for Exceptions!
March 22, 2014 at 9:25 am
Hi,
I would have similar observation as Luis and would concentrate on the requirements and constraints. Your task is to tune a bad performed query written by someone else. Your constraints...
___________________________
Do Not Optimize for Exceptions!
March 21, 2014 at 3:24 pm
You cannot say in advance if Key Lookup is good or bad. If your query needs to return several columns you cannot avoid it (or you can if you scan...
___________________________
Do Not Optimize for Exceptions!
March 21, 2014 at 2:32 pm
Hi again,
You can use the statement provided by Scott, too to avoid usage of UNION ALL:
SELECT *,
ROW_NUMBER() OVER(PARTITION BY OrderID
ORDER BY CASE WHEN ItemTypeID = '4006' THEN...
___________________________
Do Not Optimize for Exceptions!
March 20, 2014 at 4:31 pm
These data types are deprecated since the version SQL Server 2008. It seems that Microsoft still has customers using these old data types in actual workload and therefore they support...
___________________________
Do Not Optimize for Exceptions!
March 20, 2014 at 1:04 pm
I hope that I interpreted well your requirements:
SELECT *, 1 AS ItemSortOrder
FROM @ItemList
WHERE ItemTypeID = 4006
UNION ALL
SELECT *,
(1 + ROW_NUMBER() OVER(PARTITION BY OrderID ORDER BY ItemID)) AS ItemSortOrder...
___________________________
Do Not Optimize for Exceptions!
March 20, 2014 at 12:53 pm
SELECT t1.address, t1.temperature, t1.last_update, app2.temperature temperature_t2, app2.last_update last_update_t2
FROM table1 t1
OUTER APPLY
(
SELECT TOP 1 t2.Address,t2.last_update FROM TABLE2 t2 WHERE t1.Address=t1.Address ORDER BY...
___________________________
Do Not Optimize for Exceptions!
February 28, 2014 at 6:30 pm
Igor,
An index seek in your second example has been chosen by the optimizer because the query is not parametrized. You simply concatenated the query text and the resolution about the...
___________________________
Do Not Optimize for Exceptions!
February 27, 2014 at 2:31 pm
dj341 (2/26/2014)
robert.diley (2/26/2014)
(1 row(s) affected)
Msg 8134, Level 16, State 1, Procedure TestProc, Line 6
Divide by zero error...
___________________________
Do Not Optimize for Exceptions!
February 26, 2014 at 2:35 pm
Viewing 15 posts - 16 through 30 (of 56 total)