Use of With Clause in SQL Server

前端 未结 3 1052
北恋
北恋 2020-12-21 11:17

How does with clause work in SQL Server? Does it really give me some performance boost or does it just help to make more readable scripts?

When it is ri

3条回答
  •  甜味超标
    2020-12-21 11:46

    with is a keyword in SQL which just stores the temporary result in a temporary table. Example:

    with a(--here a is the temporary table)
    (id)(--id acts as colomn for table a )
     as(select colomn_name from table_name )
    
    select * from a
    

提交回复
热议问题