Differnece between SelectStatement in View and StoredProcedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baburk
    New Member
    • Oct 2006
    • 111

    Differnece between SelectStatement in View and StoredProcedure

    Hi All,

    We all are creating Select statement both in View and StoredProcedure

    In view it virtually links to tables.

    What is the difference.

    Thanks in advance
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    By basic definition, SELECT is the way you read data in a PSQL environment. For quite some time now, it's also being used to assign values to variables and also to COLUMN alias.

    A stored procedure is a collection of T-SQL commands and statements that you want to be executed sequentially in a batch. If properly handled, you can even set it up to run successfully or not run at all. A stored procedure does not require and does always have SELECT statement. If you need to read data on your table, you have to use SELECT statement.

    View, on the other hand, is like a temporary table staying in the memory. Once created it will run a SELECT statement against all the tables on your view definition statement and return the resulting record set as if it's a single table. A view may or may not be update-able.


    Here are more readings

    SELECT (T-SQL)


    Stored Proc for Beginners

    View Basics

    -- CK

    Comment

    Working...