This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, | |
CASE WHEN S1.Name IS NULL THEN 'INSERT INTO Setting VALUES ('''+S2.Name+''', '''+S2.Value+''', '+cast(S2.StoreId as varchar)+')' | |
ELSE 'UPDATE Setting SET [Value] = '''+S2.Value+''' WHERE [Name] = '''+S2.Name+''' ' END AS [SQL] | |
FROM Setting S1 | |
FULL OUTER JOIN NopCommerceStage.dbo.Setting S2 ON S1.[Name]=S2.[Name] | |
WHERE ISNULL(S1.Value, '') <> ISNULL(S2.Value, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE Polr_ClearLog | |
@Days int = 30, | |
@OnlyInfo bit = 1 | |
AS | |
BEGIN | |
DELETE FROM [Log] | |
WHERE [CreatedOnUtc] < DATEADD(DAY, -@Days, GETDATE()) | |
AND [LogLevelId] = CASE @OnlyInfo WHEN 1 THEN 20 ELSE [LogLevelId] END | |
END | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE SPLIT_COMMA(TEXT nvarchar(1000)) | |
AS | |
BEGIN | |
declare _items nvarchar(1000) ARRAY; | |
declare _text nvarchar(1000); | |
declare _index integer; | |
_text := :TEXT; | |
_index := 1; | |
WHILE LOCATE(:_text,',') > 0 DO | |
_items[:_index] := SUBSTR_BEFORE(:_text,','); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @SpecificationAttributeId INT = 0; | |
DELETE FROM GenericAttribute WHERE keygroup LIKE 'ProductSpecificationAttribute' | |
AND EntityId IN (SELECT Id FROM Product_SpecificationAttribute_Mapping WHERE SpecificationAttributeOptionId IN (SELECT Id FROM SpecificationAttributeOption WHERE SpecificationAttributeId = @SpecificationAttributeId)); | |
DELETE FROM GenericAttribute WHERE keygroup LIKE 'SpecificationAttributeOption' AND EntityId IN(SELECT Id FROM SpecificationAttributeOption WHERE SpecificationAttributeId = @SpecificationAttributeId); | |
DELETE FROM SpecificationAttributeOption WHERE SpecificationAttributeId = @SpecificationAttributeId; | |
DELETE FROM Product_SpecificationAttribute_Mapping WHERE SpecificationAttributeOptionId IN(SELECT Id FROM SpecificationAttributeOption WHERE SpecificationAttributeId = @SpecificationAttributeId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' ` -Argument 'Restart-Service -Name SBOMail' | |
$trigger = New-ScheduledTaskTrigger -Daily -At 6am | |
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount | |
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Restart SBOMail" -Principal $principal | |
Pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE Polr_UpdateLongDescrByComboSku | |
@Sku nvarchar(max), | |
@LongDescription nvarchar(max), | |
@LanguageId int = null | |
AS | |
BEGIN | |
IF @LanguageId IS NULL | |
BEGIN | |
UPDATE Product SET [FullDescription] = @LongDescription FROM Product AS p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT REPLACE(COALESCE(T1."Cellolar",T1."Tel1",T1."Tel2", T0."Cellular", T0."Phone1", T0."Phone2"), ' ', '') FROM "OCRD" T0 | |
LEFT JOIN "OCPR" T1 ON T1."CardCode"=T0."CardCode" AND T1."CntctCode" = $[ORDR."CntctCode"] | |
WHERE T0."CardCode" = $[ORDR."CardCode"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION dbo.FINDSTRING (@character_expression nvarchar(1), @searchstring nvarchar(128), @occurance int) | |
RETURNS INT | |
AS | |
BEGIN | |
DECLARE @ret int , @pos int = CHARINDEX(@character_expression, @searchstring), @count int = 0 | |
WHILE @pos > 0 | |
BEGIN | |
SET @count = @count + 1 | |
IF @count = @occurance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let qtyIterator = table(line); | |
for i in range(0, inAntal) do | |
set qtyIterator = qtyIterator & [line: i]; | |
done | |
return qtyIterator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM [GenericAttribute] WHERE [Id] IN ( | |
SELECT [T0].[Id] FROM [GenericAttribute] AS [T0] | |
LEFT JOIN [Customer] AS [T1] ON [T1].[Id]=[T0].[EntityId] | |
WHERE [T0].[KeyGroup]='Customer' AND [T1].[Id] IS NULL | |
) | |
DELETE FROM [GenericAttribute] WHERE [Id] IN ( | |
SELECT [T0].[Id] FROM [GenericAttribute] AS [T0] | |
LEFT JOIN [ProductAttributeValue] AS [T1] ON [T1].[Id]=[T0].[EntityId] | |
WHERE [T0].[KeyGroup]='ProductAttributeValue' AND [T1].[Id] IS NULL |