SQL SELECT using XML input

webDosser

New Member
I've currently got a C# application that responds to HTTP requests. The body of the HTTP request (XML) is passed to SQL Server, at which time the database engine performs the correct instruction. One of the instructions is used to load information about Invoices using the id of the customer(InvoiceLoad): \[code\]<InvoiceLoad ControlNumber="12345678901"> <Invoice> <CustomerID>[email protected]</CustomerID> </Invoice></InvoiceLoad> \[/code\]I need to perform a SELECT operation against the invoice table (which contains the associated email address). I've tried using: \[code\]SELECT 'Date', 'Status', 'Location' FROM Invoices WHERE Email_Address = Invoice.A.value(.) using an xml.nodes('InvoiceLoad/Invoice/CustomerId') Invoice(A)\[/code\]command. However, as this query may run THOUSANDS of times per minute, I want to make it as fast as possible. I'm hearing that one way to do this may be to use CROSS APPLY (which I have never used). Is that the solution? If not, how exactly would I go about making this query as fast as possible? Any and all suggestions are greatly appreciated!
 
Back
Top