Viewing 15 posts - 4,321 through 4,335 (of 10,144 total)
SELECT op, SUM(CASE WHEN dupes > 1 THEN 1 ELSE 0 END)
FROM (
SELECT op, imei, dupes = COUNT(*)
FROM #mastertab
GROUP BY op, imei
) d
GROUP BY op
July 22, 2013 at 5:54 am
Use an inline tally table as a row generator. Generate the week-based rows and the month-based rows separately:
DROP TABLE #dates
CREATE TABLE #dates (date_debut DATE,date_end DATE)
DECLARE @date_start DATE, @date_end DATE,...
July 22, 2013 at 5:24 am
John Mitchell-245523 (7/22/2013)
Two options - the first being vastly more preferable:
(1) Don't store...
July 22, 2013 at 4:45 am
Can you provide more information about the context please Ananth? For instance, are you designing a validation process for an import of a text-typed date?
July 22, 2013 at 4:08 am
jerome.morris (7/19/2013)
Ok Chris, I think I understand, but when I remove the simple data based on my table and use the real table it returns no results
It does return results:
ChrisM@Work...
July 22, 2013 at 2:13 am
There's scope for improvement but without ddl/execution plan it's a long shot. Try this:
SELECT
t.TradeId,
CASE WHEN x.OtpTradeId IS NULL THEN 'Y' Else 'N' End As 'TCM'
FROM Trade t
OUTER APPLY...
July 19, 2013 at 7:37 am
It creates a CTE consisting of a single datetime column - a very simple sample data set of your docket table.
July 19, 2013 at 7:26 am
krypto69 (7/19/2013)
geez..thanks Chris...need to get some coffee..
Can I have some too? 🙂
July 19, 2013 at 7:16 am
You're renamed the column to [Earn Code] in the inner select.
July 19, 2013 at 7:14 am
Cool, now post this code into the same ssms window underneath the rest of the code and run the lot as one batch:
SELECT *
FROM dbo.DocketTB
CROSS APPLY (
SELECT MondayLastWeek =...
July 19, 2013 at 7:09 am
Steve-3_5_7_9 (7/19/2013)
kapil_kk (7/19/2013)
NO you cant add the IDENTITY property to the existing column using a sql query....But it can be done from edit design of a table
Of course you can....
July 19, 2013 at 6:43 am
Curious...ok, paste this whole batch into a new ssms window and execute:
DECLARE @RangeStart DATETIME, @RangeEnd DATETIME
SELECT
@RangeStart = x1.MondayLastWeek,
@RangeEnd = DATEADD(DD,7,x1.MondayLastWeek)
FROM (
SELECT MondayLastWeek = DATEADD(hh,7,CAST(CAST(DATEADD(DD,-((DATEDIFF(DD,0,GETDATE())%7)+7),GETDATE()) AS DATE) AS DATETIME))
)...
July 19, 2013 at 6:39 am
Like this?
With subCA As (
Select distinct
OTPTradeId,
ConfoAuditSenderRef
from ConfirmationAudit
where ConfoAuditSenderRef like 'HBEUM%'
),
TCM As (
Select distinct
OTPTradeID
from subCA
union ALL
select TradeId
from subCA
inner join ConfirmationSent
on...
July 19, 2013 at 6:21 am
jerome.morris (7/19/2013)
Point taken Chris, but even if I did I wouldn't get results as I don't them in in the SSMS query?
Check:
SELECT TOP 100 Docket_EngFinish
FROM DocketTB
ORDER BY Docket_EngFinish DESC
July 19, 2013 at 6:10 am
Viewing 15 posts - 4,321 through 4,335 (of 10,144 total)