Skip to content

Instantly share code, notes, and snippets.

@PiotrFerenc
PiotrFerenc / gist:dd4ae2d70022327638b856ecdeec9831
Created December 6, 2024 13:36
Porównanie danych z dwóch tabel
-- Wyświetlenie różnic między dwoma tabelami
SELECT
'TABELA_1 -> TABELA_2' AS RÓŻNICA,
t1.*
FROM
TABELA_1 t1
LEFT JOIN
TABELA_2 t2
ON
t1.id = t2.id
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>MyAnalyzerPackage</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Authors>Your Name</Authors>
<Company>Your Company</Company>
// Tworzenie wyrażenia "x => x.Property != null && x.Property.Contains(value)"
var parameter = propertyExpression.Parameters[0]; // Pobierz parametr lambda z propertyExpression (np. x)
var property = propertyExpression.Body; // Pobierz ciało wyrażenia (np. x.Property)
// Utwórz wyrażenie "x.Property != null"
var notNullExpression = Expression.NotEqual(property, Expression.Constant(null, typeof(string)));
// Wyszukaj metodę "Contains" na typie string
var containsMethod = typeof(string).GetMethod(nameof(string.Contains), new[] { typeof(string) });
if (containsMethod == null)
public interface IWorkflowStep
{
string Name { get; }
Task<WorkflowResult> ExecuteAsync(WorkflowContext context);
}
public class WorkflowResult
{
public bool Success { get; set; }
public string? Message { get; set; }
public static string GetDifference(string baseString, string comparedString)
{
if (baseString == null || comparedString == null)
throw new ArgumentNullException("Input strings cannot be null.");
if (comparedString.StartsWith(baseString))
{
// Jeśli comparedString zaczyna się od baseString, zwróć różnicę
return comparedString.Substring(baseString.Length);
}
SELECT
OBJECT_NAME(i.object_id) AS TableName,
i.name AS IndexName,
i.index_id,
i.type_desc,
i.is_unique,
i.is_primary_key,
i.is_disabled
FROM
sys.indexes i