Viewing 15 posts - 766 through 780 (of 10,144 total)
SELECT
d.[Date],
OrderID = ISNULL(o.orderid, y.orderid),
MissingDays = ISNULL(DATEDIFF(DAY,x.LastOrd,d.[Date]),0),
Cost = ISNULL(o.cost,y.cost)
FROM #DateInfo d
LEFT JOIN #Orders o
ON o.orderdate = d.[Date]
OUTER APPLY...
May 15, 2017 at 2:42 am
I can't help thinking you're going to miss an opportunity to make this exercise vastly simpler:ALTER VIEW dbo.vw_WeekMonths ASSELECT
DateMonth = m.n+1,
WeekNumber = ROW_NUMBER()...
May 12, 2017 at 9:50 am
May 12, 2017 at 2:45 am
WHEN EndTime LIKE '[0-9][0-9][0-9][0-9]' THEN LEFT(dbo.RemoveNonNumericChar(EndTime),2) + ':' + RIGHT(dbo.RemoveNonNumericChar(EndTime),2) + ':00.0000000'
and this...
May 12, 2017 at 2:36 am
Join to a query or to a table:
SELECT
res.DateFrom,
res.DateTo
FROM (SELECT StartOfYear = DATEADD(YEAR,DATEDIFF(YEAR,0,GETDATE()),0)) d
CROSS APPLY (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11)) m (n)
CROSS...
May 12, 2017 at 2:14 am
May 11, 2017 at 10:02 am
May 10, 2017 at 8:25 am
Well, actually, he's just getting errors when creating a...
May 10, 2017 at 7:45 am
-- Depending on the size of CustValue * CustArea partitions,
-- it might be worthwhile picking just one row
May 10, 2017 at 7:29 am
We have been running some delete statemets on some tables which contains nearly 20 core...
May 10, 2017 at 4:51 am
I have an ARTICLE table and a...
May 9, 2017 at 1:17 am
I have the following code in a SP to deliver the next available lead for users....
May 8, 2017 at 11:31 pm
Thanks for the feedback, Adam. Holler if you get stuck.
May 8, 2017 at 9:16 am
I agree with Thom, Steve & John and offer an alternative resolution:SELECT
R.TxnID,
SUM(x1.cnt) AS ATotal,
SUM(x2.cnt) AS PTotal,
SUM(x1.cnt) + SUM(x2.cnt) AS AplusPTotal
FROM...
May 8, 2017 at 7:57 am
May 8, 2017 at 4:30 am
Viewing 15 posts - 766 through 780 (of 10,144 total)