LInq to sql query

Posted by Mohit on Stack Overflow See other posts from Stack Overflow or by Mohit
Published on 2010-04-14T18:17:58Z Indexed on 2010/04/14 18:23 UTC
Read the original article Hit count: 272

Filed under:

Hi,

I have a sql query as follows:

Declare @DivisionNo INT

SET @DivisionNo = 5117

SELECT distinct CASE WHEN ISNULL([DivisionNo],'') <> @DivisionNo THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo

  --,[RecordID]

  ,[AcctCat]

  ,[AcctCatDesc]

  ,[CostCode]

  ,[CostCodeDesc]

FROM [dbo].[vw_eSchdl_AcctCat_CostCode]

WHERE DivisionNo = @DivisionNo

UNION

SELECT distinct CASE WHEN ISNULL([DivisionNo],'') <> @DivisionNo THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo

  --,[RecordID]

  ,[AcctCat]

  ,[AcctCatDesc]

  ,[CostCode]

  ,[CostCodeDesc]

FROM [dbo].[vw_eSchdl_AcctCat_CostCode]

WHERE AcctCat not in (

SELECT [AcctCat]

FROM [dbo].[vw_eSchdl_AcctCat_CostCode]

WHERE DivisionNo = @DivisionNo)

How can I duplicate it using linq to sql?

Thanks

© Stack Overflow or respective owner

Related posts about linq-to-sql