Include a blank row in query results

前端 未结 3 1915
忘了有多久
忘了有多久 2021-01-25 05:44

Is there a way to include a blank row at the top of a sql query, eg if it is meant for a dropdown list? (MS Sql Server 2005 or 2008)

Select * 
  FROM datStatus          


        
3条回答
  •  花落未央
    2021-01-25 05:52

    I have found that it is better to do this in the presentation layer of your application, as you might have different requirements based on the context. In general I try to keep my data service layer free of these sorts of implementation specific rules. So in your case I would usually just add a new item by index in the first position of the list, after i had loaded it with data from my service layer.

    Enjoy!

提交回复
热议问题