Viewing 15 posts - 6,871 through 6,885 (of 8,731 total)
My crystal ball says this might work:
SELECT ID,
PreviousYear_Profit,
SUM( PreviousYear_Profit) OVER (PARTITION BY (SELECT NULL)) AS PriorVersion ,
SUM( PreviousYear_Profit) OVER (PARTITION BY (SELECT NULL)) - PreviousYear_Profit AS Variance
FROM calculate
This is a...
February 19, 2014 at 9:24 am
Without sample data, I guess you need to do something like this:
SELECTph.CalculatedTotalTime,
ph.ProdHeaderDossierCode,
ph.MachGrpCode,
ph.EmpId,
pd.PartCode
FROMdbo.T_ProcessedHour ph
JOINdbo.T_ProductionHeader pd ON ph.ProdHeaderDossierCode = pd.ProdHeaderDossierCode
JOINdbo.T_DossierMain dm ON pd.DossierCode = dm.DossierCode
whereph.RegDate >= '2013-01-01 00:00:00:000' and
dm.DelDate < getdate() and
ph.MachGrpCode...
February 19, 2014 at 9:02 am
Ed Wagner (2/19/2014)
GilaMonster (2/19/2014)
It's not necessarily the easy questions that we moan about. It's the ones with no thought or no research or the ones that...
February 19, 2014 at 8:29 am
Has anyone played with your batch separator settings?
February 19, 2014 at 8:20 am
You could use CHARINDEX and SUBSTRING functions like this:
WITH Samp AS(
SELECT 'TL43:The product has no marked price.;' AS SomeText
)
SELECT LEFT( SomeText, CHARINDEX(':', SomeText) - 1),
SUBSTRING(SomeText, CHARINDEX(':', SomeText) + 1, CHARINDEX(';',...
February 18, 2014 at 5:30 pm
You're just too kind :blush:
I'm just someone who loves to help 🙂
February 18, 2014 at 5:18 pm
Maybe something like this:
SELECT MIN(id) id
FROM sample t1
WHERE EXISTS(SELECT 1
FROM sample t2
WHERE t1.islabel != t2.islabel
AND t1.mark = t2.mark)
GROUP BY mark, islabel
ORDER BY id
Do you understand how...
February 18, 2014 at 5:00 pm
I'm not sure what's happening here. Maybe someone else can explain this.
It seems that you can correct this using a binary collation in the replace.
with sampledata as (
SELECT N'Something' +...
February 18, 2014 at 4:46 pm
This:
where t1.mark = 0 and t2.mark = 1
Should be like this:
WHERE t1.islabel = 0 and t2.islabel = 1
Is that correct?
February 18, 2014 at 4:33 pm
Matt Miller (#4) (2/18/2014)
Luis Cazares (2/17/2014)
Or I can marry and move out 😀Or marry, move out and transfer all support calls to the spouse 😀
+10
February 18, 2014 at 4:26 pm
You could think of CTEs as subqueries that are in a different position or as one-use views.
To post formatted code, you just have to put it between the code tags...
February 18, 2014 at 3:51 pm
Are you sure is NCHAR(65533)?
Here's something you can use to identify it.
WITH E1(N) AS(
SELECT N FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))e(N)
),
E2(N) AS(
SELECT a.N FROM E1 a, E1 b
),
E4(N) AS(
SELECT a.N FROM E2 a, E2...
February 18, 2014 at 3:09 pm
Just to be sure. Do you understand how it works? Which option did you take?
February 18, 2014 at 2:53 pm
Could you use REPLACE? Or would that be a problem with your real data?
February 18, 2014 at 1:49 pm
Sean Lange (2/18/2014)
OCTom (2/18/2014)
Answer: "I'm not really...
February 18, 2014 at 1:48 pm
Viewing 15 posts - 6,871 through 6,885 (of 8,731 total)