Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using Select Case based on the And condition

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-14 : 22:26:38
Anthony White writes "Dear SQLTeam,

I have a two part question. I have attempted to conditionally set queries based upon fields being NULL, but the query returns a error '80020009' Exception occurred.

Secondly, I have tested the sqlstmt statements separately and I cannot return a dataset from my query using And. But I can see a dataset if I replace the No and ID variables, with real values.

Can anyone help.

Thanks,
Anthony



Select Case "rs.Field"

Case "PolicyDate"

sqlstmt = "SELECT PolicyNumber,Title,PolicyDate, ProcedureDate,GuidelineDate, Choice, Policy FROM Policy where PolicyNumber like '%" & No & "%' AND PolicyDate like '%" & ID & "%'"

Case "ProcedureDate"

sqlstmt = "SELECT PolicyNumber,Title,PolicyDate, ProcedureDate,GuidelineDate, Choice, Policy FROM Policy where PolicyNumber like '%" & No & "%' AND ProcedureDate like '%" & PRDate & "%'"

Case Else

sqlstmt = "SELECT PolicyNumber, Title,PolicyDate, ProcedureDate,GuidelineDate, Choice,Policy FROM Policy where PolicyNumber like '%" & No & "%' AND GuidelineDate like '%" & GDate & "%'"

End Select"
   

- Advertisement -