Viewing 15 posts - 6,196 through 6,210 (of 10,144 total)
This works quite nicely too:
SELECT
EmployeeID,
Email,
DomainLHS = SUBSTRING(Email, x.PosStart,x.PosEnd-x.PosStart),
DomainRHS = SUBSTRING(Email, y.PosStart,y.PosEnd-y.PosStart)
FROM @t
CROSS APPLY (
SELECT PosStart = 1+CHARINDEX('@',EMAIL,1),
PosEnd = NULLIF(CHARINDEX('.',EMAIL,CHARINDEX('@',EMAIL,1)),0)
) x
CROSS APPLY (
SELECT PosStart = NULLIF(1+CHARINDEX('@',EMAIL,x.PosEnd),1),
PosEnd =...
June 25, 2012 at 9:37 am
Sean Lange (6/25/2012)
Is there a question here?
Only yours, Sean 😉
June 25, 2012 at 7:53 am
No problem:
select distinct likp.VBELN as delivery,vbak.VBELN as sales_document,vbrp.VBELN as bill_no,
vbrk.FKDAT as invoice_date,AUDAT as sales_order_date,likp.ZZCND as delivery_date,likp.PODAT as POD_date,
submission_date as sub_date,vbak.ZZP01 as payment_rule,vbrk.ZTERM as payment_term,
(case
when vbak.ZZP01 = 'A' then DATEADD(DD,x.DateDelta,likp.ZZCND)
when vbak.ZZP01...
June 25, 2012 at 7:40 am
Don't forget the rCTE version:
;WITH OrderedData AS (SELECT *, rn = ROW_NUMBER() OVER (ORDER BY HotelId, RoomTypeId, DateKey DESC) FROM @booking),
Calculator AS (
SELECT rn, Id, HotelId, RoomTypeId, DateKey, FreeCount,
Availability =...
June 25, 2012 at 7:24 am
Change the final select to this:
SELECT
LevelNum,
MemberID,
sortorder,
ProductID, SaleClosedPrice,
CAST(REPLICATE(' | ', LevelNum - 1) + MemberName AS VARCHAR(100)) AS MemberName,
[Commission%],
[Incentive%]
FROM Hierarchy
CROSS APPLY (SELECT [Commission%] = CASE WHEN LevelNum = 1...
June 25, 2012 at 6:24 am
SaleClosePrice and Commission% are both returned by me last query. I can't understand where you are having a problem - surely all you have to do is multiply the two?
DECLARE@MemberID...
June 25, 2012 at 5:51 am
sivag (6/25/2012)
from the closed price of the sale only the...
June 25, 2012 at 5:09 am
vinu512 (6/25/2012)
Thanks for all the replies. I solved the problem. Well, technically... I didn't solve it, I took a Work around.
My Procedure had the following Query:
SELECT Distinct a.BookCode, b.MaterialType,...
June 25, 2012 at 5:04 am
sivag (6/25/2012)
CAST(REPLICATE(' | ', LevelNum - 1) + MemberName AS VARCHAR(100)) AS MemberName,
[Commission] = CASE WHEN LevelNum = 1 THEN 6 ELSE 2 END
i need...
June 25, 2012 at 4:42 am
Try this. I've left in several columns to show how the query works, and omitted the final aggregate of the results.
DECLARE@MemberID INTEGER = 1
;WITH
MemberAndParent AS (
SELECT m.MemberID, m.Name AS...
June 25, 2012 at 4:16 am
Please make sure your DDL/DML statements actually do work before posting them here.
A few questions:
How much commission does Siva get for selling ProductID = 1?
How much commission does Siva get...
June 25, 2012 at 3:48 am
vinu512 (6/25/2012)
I've simplified the requirement further.
The following query runs in 4 seconds on the above mention table having 40,000+rows bringing back the...
June 25, 2012 at 2:42 am
Ted_Kert (6/24/2012)
How do I know if a join (e.g., INNER, OUTER, etc.) is a star or merge join?
What's your context? If you're attempting to identify Star-join optimisation, then here's a...
June 25, 2012 at 2:10 am
dwain.c (6/22/2012)
June 22, 2012 at 7:20 am
Nthuloane.Marotholi (6/22/2012)
select distinct C.*...
June 22, 2012 at 3:42 am
Viewing 15 posts - 6,196 through 6,210 (of 10,144 total)