alternative to store procedure

Shambhu Rai 1,406 Reputation points
2023-09-14T13:26:11.2666667+00:00

Hi Expert,

do we have any alternative to store procedure while running merge statement where we can use exec or run like

exec sp_name

can we use view instead of any table to something else

Regards

Azure SQL Edge
Azure SQL Edge
An Azure service that provides a small-footprint, edge-optimized data engine with built-in artificial intelligence. Previously known as Azure SQL Database Edge.
45 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,756 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,457 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
495 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,245 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Muhammad Umair 80 Reputation points
    2023-09-14T13:29:29.7066667+00:00

    While views are useful for simplifying data access, they cannot replace stored procedures for running complex data manipulation operations like MERGE. Stored procedures are the preferred method for encapsulating such logic in the database.


  2. CosmogHong-MSFT 23,321 Reputation points Microsoft Vendor
    2023-09-15T02:50:10.7766667+00:00

    Hi @Shambhu Rai

    do we have any alternative to store procedure while running merge statement can we use view instead of any table to something else

    No, you cannot.

    View and Stored procedure are different things.

    A view represents a virtual table definited with SELECT statement. You can join multiple tables in a view and use the view to present the data as if the data were coming from a single table.

    Stored procedures are programs that can perform multiple operations, such as inserting, updating, deleting, or selecting data.

    Best regards,

    Cosmog Hong

    0 comments No comments

  3. Olaf Helper 40,901 Reputation points
    2023-09-15T04:51:31.1166667+00:00

    do we have any alternative to store procedure

    What for an alternative, in which way? A stored procedure is the one for business logic.

    can we use view instead

    In a view only SELECT statements are allowed, DML like MERGE are not possible/not allowed.