What are the downsides of using SqlServer Views?

后端 未结 10 1284
情歌与酒
情歌与酒 2020-12-29 05:04

What are the downsides of using SqlServer Views?

I create views frequently to show my data in a denormalized form.

I find it much easier and therefore fas

10条回答
  •  一向
    一向 (楼主)
    2020-12-29 05:42

    The following is a SQL hack that allows an order by to be referenced in a view:

    create view toto1 as 
    select top 99.9999 percent F1
    from Db1.dbo.T1 as a 
    order by 1
    

    But my preference is to use Row_Number:

    create view toto2 as 
    select *,  ROW_NUMBER() over (order by [F1]) as RowN from ( 
    select f1
    from Db1.dbo.T1) as a
    

提交回复
热议问题