Viewing 15 posts - 511 through 525 (of 1,464 total)
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
You would be much better off storing your values in the DB with the correct data types. Then you can format the values any way you want in the presentation...
July 16, 2019 at 8:52 am
You are counting the total number of unique records.
You need to get a count per unique set of values
SELECT MainHoldingID, OfferingElementID, [Count] = COUNT(*)
FROM...
July 15, 2019 at 12:39 pm
You cold always try TABLESAMPLE
SELECT *
FROM SchemaName.TableName TABLESAMPLE (100000 ROWS)
July 12, 2019 at 7:09 pm
Perhaps this code will point you in the right direction
WeekNum = DATEDIFF(dd, '1753', [YourDate]) /7 *7 -- Always works for week start on Monday
July 12, 2019 at 5:04 pm
Viewing 15 posts - 511 through 525 (of 1,464 total)