Sql server heritage in Procedure

Asked

Viewed 21 times

-3

I’m having performance problems using views mapped in the EPH to use linq for grouping and paging. It would have a way to assemble a procedure basis, where I explained what it would take for all the procedures daughters implement?

Or some form of template?

1 answer

0

Hi, Gilmar. All right?

At first you could check if creating indexes can improve the performance of your views, if you haven’t seen it yet. Another way to solve it is to materialize the data of the views in physical tables, but it can end up occupying enough space.

Regarding your last question, it is possible to assemble this structure yes. You can create a precedent (base) that has a output, and, from this output feed the parameter of the other variables. See the following example:

-- Declare the variable to receive the output value of the procedure.  
DECLARE @SalesYTDBySalesPerson money;  
-- Execute the procedure specifying a last name for the input parameter  
-- and saving the output value in the variable @SalesYTDBySalesPerson 

EXECUTE Sales.spGetEmployeeSalesExemplo_Base  
    N'Blythe', @SalesYTD = @SalesYTDBySalesPerson OUTPUT;  

--Executando a procedure (Filha) com o parametro retornado da procedure base 
EXECUTE Sales.spSalesExemplo_Filha @SalesPerson = @SalesYTDBySalesPerson;  
GO

For more details you can check the documentation from where I adapted the code: https://docs.microsoft.com/pt-br/sql/relational-databases/stored-procedures/return-data-from-a-stored-procedure?view=sql-server-ver15

Remembering that, this is just one of the ways to solve the problem. A second alternative would be the "food" /popular base design of a table with parameters that will be used/consumed by the daughter procedures.

If you need help to assemble the solution, you can contact me. I’ll be happy to help.

Abs. Welricsson Carmo

  • Thanks for the tip, but I don’t think it will solve, because I found this limitation there: 'A nonscrollable cursor is opened in a Procedure on a result set named RS of 100 Rows'. Thinking that one precedent would be the query itself the other would be the paging, the person responsible for the paging cannot receive only 100 lines, needed to receive the 'full query' and it set the top 10 (for example).

  • I get it. It’s very specific. I would have to see in detail to know what to do. I found something similar here at Stackoverflow. See if it helps you in any way: https://answall.com/questions/168260/limit-e-offset-para-pagina%C3%A7%C3%A3o-web-em-sql-server

Browser other questions tagged

You are not signed in. Login or sign up in order to post.