Viewing 15 posts - 511 through 525 (of 1,468 total)
DesNorton,
I see what you are saying now. I was reading it wrong. But what about my second post where SQL says 'CK_isActive' is not a constraint? I don't understand...
August 1, 2019 at 4:34 am
Remove the where clause. then it does all products
July 31, 2019 at 12:03 pm
This is a simple SUM with GROUP BY
SELECT t.BoughtDate
, Apples = SUM( t.BoughtApples )
...
July 31, 2019 at 6:28 am
Edit: I ran this part of the code only to see if I can isolate the problem:
ALTER TABLE Costpoint.ProjectCodes
DROP CONSTRAINT CK_isActive;
and I got this error message:
July 31, 2019 at 6:15 am
Thanks Des! (I hope that was a hard query... otherwise, I'm in trouble!)
Piet, we all have days where we battle with the task at hand. Once the solution has...
July 30, 2019 at 6:26 am
The code can be re-written with 1 less CROSS APLY
SELECT invoiceID = SUBSTRING(t.invoiceID, x.StartPos, 6)
,...
July 29, 2019 at 3:00 pm
The following code appears to fulfill your requirements
SELECT invoiceID = SUBSTRING(t.invoiceID, sq.StartPos, 6)
, t.amount
...
July 29, 2019 at 2:20 pm
I haven't done this for many years. But I recall needing double path separators
'C:\\Users\\Administrator\\OneDrive - NAme of Company\\SQLBackup\\'
July 24, 2019 at 2:47 pm
Dear Everyone I wanted to know the statement below will it delete everything in the last 30 days or anything before the last 30 days? DELETE FROM tb_LogIP WHERE...
July 24, 2019 at 9:35 am
Below is the dynamic SQL version of the equivalent CrossTab query. I would suggest a performance test against your data.
DECLARE @sql NVARCHAR(MAX);
DECLARE @Columns NVARCHAR(MAX) = N'';
SELECT ...
July 23, 2019 at 3:36 pm
July 23, 2019 at 4:27 am
You need to only GROUP BY STRXREFCODE
July 22, 2019 at 11:17 am
Yes, I can totally do that, but I'm asking if it's possible to do it a single query. My production query does a Dynamic Pivot using Dynamic...
July 19, 2019 at 6:09 pm
Sorry for the silly question, but if you do everything in a stored procedure, what's the difference? Maybe you have a CTE with two pivots in it, and then...
July 19, 2019 at 6:06 pm
You might be better off using a cross-tab query
SELECT
p1.DataLabel
, [CAT1 Quantity] = MAX(CASE WHEN p1.DataCategory = 'CAT1' THEN p1.Quantity END)
, [CAT2 Quantity] = MAX(CASE...
July 19, 2019 at 6:04 pm
Viewing 15 posts - 511 through 525 (of 1,468 total)