Viewing 15 posts - 391 through 405 (of 1,491 total)
I suspect your test data is missing some edge conditions but the following should get you started:
WITH ProdDays
AS
(
SELECT ProductID, LotNumber, PickPriority, DaysOfProduct, DaysBeforeExpiration
,CASE
WHEN DaysBeforeExpiration < DaysOfProduct
THEN...
August 3, 2021 at 11:11 am
-- *** Test Data which you should have provided. ***
SET ANSI_NULLS, QUOTED_IDENTIFIER, ANSI_PADDING ON
GO
CREATE TABLE #t
(
PartitionNo int NOT NULL
,PartitionOrder int NOT NULL
,ColA int NOT NULL
,ColB int NOT...
August 2, 2021 at 4:04 pm
If nested triggers are disabled, just create an instead of insert trigger which filters the inserted table on the conditions you want. eg:
CREATE TRIGGER TR_I_YourTable
ON YourTable
INSTEAD OF...
July 26, 2021 at 2:03 pm
I have not managed to inadvertently shutdown a server but I have accidentally shutdown, instead of restarting, my work PC twice when tired over the last 16 months. I now...
July 21, 2021 at 8:01 pm
You have a basic syntax error calling the proc:
DECLARE @TotalValFromProc money
,@RetVal int;
EXEC @RetVal = dbo.spAmount_V1 @Customer_ID, @Year, @Sample_ID, @TotalValFromProc OUTPUT;
SET @TotalVal = @TotalVal + @TotalValFromProc;
Also you should...
June 8, 2021 at 8:24 am
This is JSON:
eg
SELECT JSON_VALUE(ce_data, '$.declaration')
,JSON_VALUE(ce_data, '$.applicationType')
,JSON_VALUE(ce_data, '$.deceasedAddress')
,JSON_VALUE(ce_data, '$.boDocumentsUploaded')
,JSON_VALUE(ce_data, '$.caseType')
,JSON_VALUE(ce_data, '$.ihtReferenceNumber')
,JSON_VALUE(ce_data, '$.primaryApplicantEmailAddress')
--etc
FROM #tmpTable;
June 7, 2021 at 9:00 am
Are there any Triggers, especially encrypted triggers, on the tables where select produces no rows?
June 6, 2021 at 7:11 pm
You can use a script for this sort of processing. I would use Powershell.
First download Out-DataTable from:
https://github.com/RamblingCookieMonster/PowerShell/blob/master/Out-DataTable.ps1
Then write something like:
<#
LoadCSVs.ps1
LoadCSVs -Folder <path> -db <db>
eg
. C:\Batch\Scripts\LoadCSVs.ps1
LoadCSVs -Folder...
June 1, 2021 at 12:24 pm
In future please post consumable test data with dates in ISO format:
CREATE TABLE #t
(
Staff_Number int NOT NULL
,FromDate date NOT NULL
,ToDate date NOT NULL
);
INSERT INTO #t
VALUES (10192,...
May 12, 2021 at 3:08 pm
WITH SeqBreaks
AS
(
SELECT ID, Category, [Date]
,CASE
WHEN Category = LAG(Category) OVER (PARTITION BY ID ORDER BY [Date])
THEN 0
ELSE 1
END AS SeqBreak
FROM YourTable
)
,Grps
AS
(
SELECT ID, Category, [Date]
,SUM(SeqBreak) OVER (PARTITION BY ID...
April 26, 2021 at 8:04 pm
April 26, 2021 at 1:34 pm
I take the view that, where possible, it is best to keep .Net, Java etc in the middle tier and leave the database server to do what it is best...
April 23, 2021 at 8:08 pm
You might be interested in an interesting series of articles by Itzik Ben-Gan:
https://sqlperformance.com/2021/04/t-sql-queries/number-series-solutions-4
April 22, 2021 at 8:08 am
I generally us WinSCP via Powershell. When I cannot install WinSCP I use a Powershell function like:
<#
PutFileSFTP.ps1
Uploads a file to a sftp site
PutFileSFTP -LocalFile <path> -RemotePath <path>...
April 20, 2021 at 7:51 pm
Viewing 15 posts - 391 through 405 (of 1,491 total)