How to create a unique constraint just on the date part of a datetime?

前端 未结 4 1999
夕颜
夕颜 2021-01-02 06:13

I\'m writing a very simple blog engine for own use (since every blog engine I encountered is too complex). I want to be able to uniquely identify each post by its URL which

4条回答
  •  无人及你
    2021-01-02 07:02

    Since you're on 2008, use the Date datatype as Marc suggests. Otherwise, an easier solution is to have a non-computed column (which means you'll have to populate it on an INSERT) which uses the date in the format YYYYMMDD. That's an integer data type and is small and easy to use.

提交回复
热议问题