sql server - Converting VB6 procedure to SQL query -Unable find the error -
I am trying to change the VB6 process to
SQL query I am
I am noob for SQL and I'm finding it very difficult to find the
error in the query in which I am trying to create.
Guidance:
Choose from * Walt where (vault [not checked] "*" and as amp; [form] [frmClientSearch] [txtChqNo] & amp; "*") and (! [frmClientSearch] [txtContractNumber] & amp [form]; ([form] [FrmClientSearch] [TxtContractNumber] null) or (Walt [contract number] like "*" & amp.! "*")) and (([FrmClientSearch] [TxtStartDate] = [form] Walt [Czech Date] & gt.!)) and (([form] [FrmClientSearch] (! [form] [FrmClientSearch] [TxtStartDate] zero ) or! zero [txtEndDate]) or (Walt [Czech Date]. & lt ;! = [form] [frmClientSearch] [txtEndDate])) Tis query that I Challans The'm trying to Kkyh is not completely clear on when it is executed. But, when the date field is empty. I am getting an exception or SQL gives an empty output. Simple answer: You have a VB6 query that reference objects (Example [Form]! [FrmClientSearch]
What can you do, either a stored procedure or an in-line table pass value in the form of important functions and parameters
A stored procedure shows the fragment of the following code can give:.
Create process dbo.Vault_Select (@txtContractNumber VARCHAR (30), @txtChqNo VARCHAR (30), select as @txtStartDate DATETIME, @txtEndDate DATETIME) * vault where (Walt. [ contract number] like '%' + @txtContractNumber + '%') and (@txtChqNo zero or vault. [Czech number] like '%' + @txtChqNo + '%') and (@ Titiststartet iS nULL or vault . [Czech Date] & gt; = @txtStartDate) and (Tititiiaksanddets tap or vault.] & Lt; = @txtEndDate) spray calling:
EXEC Dbo.Vault_Select ('Agreement', 'Chunko', '20140120', '20141022') Whatever Mitigation is left is to call the sproc using parameters from your original question. Since this is a VB 6 digit, I'm out of it; -)
Some side note:
Whatever you are trying to do is a so-called "catch-all query" which can be performance issues depending on the table size is.
Besides, I wonder why you have a column named [contract number ], but the data type is alphanumeric, obviously. [Check No ] ... Edit: And if the data is numeric, then why would a wildcard search be required?
Comments
Post a Comment