I'm trying to convert the following simple U-SQL to T-SQL
SELECT
COUNT(*) AS returncode
FROM
@output
WHERE Record_Sequence_Number == "" OR Source_Fee_Item_ID == "" OR
(Reporting_Month == "" AND Unbilled_Reporting_Month == "" ) ;
SELECT
COUNT(*) AS returncode
FROM dbo.Fee_Reporting_Month
WHERE Fee_Reporting_Month.["Record_Sequence_Number"] = '""'
OR Fee_Reporting_Month.["Source_Fee_Item_ID"] = '""'
OR Fee_Reporting_Month.["Reporting_Month"] = '201601'
AND Fee_Reporting_Month.["Unbilled_Reporting_Month"] = '""'
@Standardize_MSS_Account_Address =
COMBINE @data AS record WITH @keywordRules AS keywordRule
ON record.Country_Join == keywordRule.Country
AND record.[PartitionID] == keywordRule.[PartitionID]
PRODUCE RowNumber string,
FieldName string,
OriginalValue string,
Value string,
IsDummy bool
USING new standardization.Implementations.
ReplacementCombiner(@"{'FieldName':'Address','Domain':'Address','KeywordRules':['Noise','Transliteration','SpecialCharacter']}");
-- Assuming you have a table named @data with columns: Country_Join, [PartitionID], and other relevant fields
-- Also, you have a table named @keywordRules with columns: Country, [PartitionID], and other relevant fields
WITH StandardizedAddresses AS (
SELECT
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS RowNumber,
'Address' AS FieldName,
OriginalValue AS Value,
CASE
WHEN OriginalValue IS NULL THEN 1
ELSE 0
END AS IsDummy
FROM @data AS record
JOIN @keywordRules AS keywordRule
ON record.Country_Join = keywordRule.Country
AND record.[PartitionID] = keywordRule.[PartitionID]
WHERE keywordRule.Domain = 'Address'
AND keywordRule.KeywordRules IN ('Noise', 'Transliteration', 'SpecialCharacter')
)
-- Now you can use the StandardizedAddresses CTE in your subsequent queries
SELECT *
FROM StandardizedAddresses;