Viewing 15 posts - 4,981 through 4,995 (of 10,144 total)
astrid 69000 (3/26/2013)
to calculate the first period i go
select sum(Count) from #table where recordday >= '2008-01-01'...
March 26, 2013 at 2:47 am
;WITH Employees AS (
SELECT TOP 1
employeeid,
FIRSTNAME,
LASTNAME,
EMAILADDRESS,
STARTDATE
FROM linkedServer.linkedDB.dbo.AUEMPLOYEE
WHERE employee.ENDDATE IS NULL -- still active
ORDER BY ACTIONDATE DESC -- most recent
)
SELECT
e.*,
org.ORGANIZATIONID,
job.JOBTITLEID
FROM Employees e
LEFT...
March 26, 2013 at 2:42 am
astrid 69000 (3/26/2013)
Jayanth, I...
March 26, 2013 at 2:22 am
matak (3/26/2013)
Expected output where @startNum < @oldnum (startnum 2 oldnum 4)changedinitial
11
32
43
24
55
66
77
88
3 rows affected
Expected output where @startNum > @oldnum (startnum 4 oldnum 2)
changedinitial
11
42
33
24
55
66
77
88
Two rows affected
Are these both correct? The second sample...
March 26, 2013 at 2:18 am
Does this help?
;WITH MyData ([day], [Count]) AS (
SELECT '2008-01-01 00:00:00.000', 3 UNION ALL
SELECT '2008-01-01 11:00:00.000', 9 UNION ALL
SELECT '2008-01-01 22:00:00.000', 3 UNION ALL
SELECT '2008-01-02 09:00:00.000',...
March 26, 2013 at 2:04 am
Chandan, you're very welcome, thank you for your generous feedback.
This exercise, resolving a simple query from a more complex query referencing many more objects, often isn't successful because of cardinality...
March 25, 2013 at 7:31 am
bugg (3/25/2013)
ChrisM@Work (3/25/2013)
Right-click on the execution plan tab, select...
March 25, 2013 at 6:20 am
OK got it. You need to change two indexes.
1. Include orderhash and status in index IX_SessionID, like this:
CREATE NONCLUSTERED INDEX [IX_sessionid] ON [dbo].[orderha]
([sessionid] ASC, OrderHash ASC) INCLUDE (Status)
2....
March 25, 2013 at 5:52 am
This article linked in my sig explains in detail how to post execution plans. They're active - .png graphics are not.
Right-click on the execution plan tab, select "Save Execution...
March 25, 2013 at 4:51 am
bugg (3/25/2013)
ChrisM@Work (3/25/2013)
bugg (3/25/2013)
Node:1
KEY: 9:72057602492792832 (860067b2b9d1) CleanCnt:2 Mode:X Flags: 0x1
Grant List 2:
Owner:0x0000000198215A40 Mode: X Flg:0x40...
March 25, 2013 at 4:30 am
bugg (3/25/2013)
Node:1
KEY: 9:72057602492792832 (860067b2b9d1) CleanCnt:2 Mode:X Flags: 0x1
Grant List 2:
Owner:0x0000000198215A40 Mode: X Flg:0x40 Ref:1 Life:02000000...
March 25, 2013 at 3:42 am
Si Thu (3/24/2013)
I have one huge table which has 1Billion records. I tried to delete unnecessary records but it took a lot of time to delete and the delete was...
March 25, 2013 at 2:19 am
Lynn Pettis (3/22/2013)
Megha P (3/22/2013)
you can also try below
;WITH CTE AS
(
SELECT docid,pages FROM #x
UNION ALL
SELECT C.docid,C.pages-1
FROM #x X INNER JOIN CTE C
ON X.docid =...
March 22, 2013 at 10:11 am
It's difficult to tell with all of those funky joins and no sample data, but you might get a win with this too;
SELECT CAST(ID AS NUMERIC(9))
INTO #Accounts
FROM dbo.SplitIDs(@vcAccountId, ',')
SELECT ...
March 22, 2013 at 8:33 am
Most folks put in this situation will look for a quick win to buy the time necessary for the complete overhaul which Grant correctly recommends.
I think you have some...
March 22, 2013 at 7:57 am
Viewing 15 posts - 4,981 through 4,995 (of 10,144 total)