0

I am writing a SSRS report and I have been given SQL query to for the SSRS report. I am trying to understand what the conditional statement means in the SQL query so, I can properly add the parameters and filters to the SSRS report. Can someone please help me understand this statement.

Statement:

         where (" & sqlcriteria & " )

         AND (Certificatenumber between '" & lngcertstartnum & "' and '" & 
            lngCertEndNum & "') 

        AND convert(int,dbo.Student.CertificateNumber) >= " & 
            CLng(txtCertNum.text) 

My understanding is that for one of filters, the certificate number has to be between start number and end number which are both long data type. I am completely lost on the second line. Can someone please help me understand this statement please.

for the first statement: I created two parameters start number and end number. When I preview it prompts people to type the number to display. Now, I assumed that we have to add the filter to so, the table will only display the values btw start and end number which is causing me errors.

for the second statement: I try to convert the certificate number to int as one of filter, but it doesnt like it and it giving me [expr]

M.Doe
  • 99
  • 1
  • 10
  • It is nothing more than a simple comparison of a CertificateNumber (converted to an integer) and what I would assume is the text from a textbox (converted to a long). `>=` means that the CertifcateNumber (in the table) must be `GREATER THAN OR EQUAL TO` whatever is in your `txtCertNum` textbox. – haag1 Jan 16 '19 at 14:42
  • okay, just to be little clear is my first statement correct because when I try to create a parameter it only has options for integer and float. Also, thats what I assume the second statement is, but when I try to add the filter it is giving me error message. I will update my question to add what I did – M.Doe Jan 16 '19 at 14:47
  • Try BIGINT instead of INT. https://stackoverflow.com/questions/14197162/what-is-the-equivalent-sql-server-type-for-the-c-sharp-long-type – Dave Brown Jan 16 '19 at 15:39
  • I will try that – M.Doe Jan 16 '19 at 17:01
  • Keep in mind that the format of this query will need to be different. The quotes and ampersands were being used to concatenate a dynamic SQL statement in a different environment. In SSRS you don't have to do that, you can pass the parameters directly into the SQL. – StevenWhite Jan 17 '19 at 16:25

0 Answers0