SQLTeam.com | Weblogs | Forums

U-SQL to T-SQL conversion

#1

Hello Community,

I have the following table

CREATE TABLE SFBI.dbo.Fee_Reporting_Month (
["Record_Sequence_Number"] VARCHAR(50) NULL
,["Source_Fee_Item_ID"] VARCHAR(50) NULL
,["Reporting_Month"] VARCHAR(50) NULL
,["Unbilled_Reporting_Month"] VARCHAR(50) NULL
,["Revision_Date"] VARCHAR(50) NULL
) ON [PRIMARY]
GO

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 == "" ) ;

The data is a follows:

"Record_Sequence_Number","Source_Fee_Item_ID","Reporting_Month","Unbilled_Reporting_Month","Revision_Date"
"2","H3MIG144405712","201601","","2019-04-05 10:53:13"
"1","","201601","","2019-04-05 10:53:13"

Can someone please help with the conversion?

Cheers

Carlton

0 Likes

#2

I figured it out guys

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"] = '""'
0 Likes