SQLTeam.com | Weblogs | Forums

Missing some rows


Hi All,
In my report I can get if the user select specific region or All Regions
so I guess in the existing SQL shown below if the Region is Null its also pulled but if the Region has spaces '' its not handling any appreciate any help . I've tried using following lines but doesn't work

OR SIT.CustomerDivision = CASE WHEN SIT.CustomerDivision =''then '1' ELSE SIT.CustomerDivision END

			AND (@Region				IS NULL		
			       OR SIT.CustomerDivision	IN (SELECT Data FROM dbo.Split(@Region,','))

The @Region values if the user selected using 'All RegionList' through form parameter its using folloiwng SQL

--DECLARE @ALLREGIONList varchar(max)

       CAST(tlkpRegion.RegionName AS varchar(5)) 
    FROM tlkpRegion


appreciate your help

 Else If ALLKAMSREGIONSRadioButton.Checked = True Then
      Dim KAMDescString As String = ""
      Dim KTitle As String = ""
      Dim ik As Integer
      KAMDescString = ALLKAMSListBox.SelectedItems(ik)
      Report.SetParameterValue("KAMsByte", KAMDescString)
      KTitle = "ALL KAMs: " 
      Report.SetParameterValue("KTitle", KTitle)
      Dim RegionDescString As String = ""
      Dim RTitle As String = ""
      Dim ir As Integer
      RegionDescString = ALLREGIONSListBox.SelectedItems(ir)
      Report.SetParameterValue("Region", RegionDescString)
      RTitle = "ALL REGIONs: " 
      Report.SetParameterValue("RTitle", RTitle)
  end if[quote="imfarhan, post:1, topic:12191, full:true"]

appreciate your help


I'm not sure what you are looking for. You've posted a combination of SQL Snippets and partial VB. Could you please post:

  1. CREATE TABLE statements for the tables involved
  2. INSERT INTO statements to populate the tables in step 1
  3. Desired result set from your query


I think you're looking for:

ISNULL(@region, '') = ''