如何在sql中按字设置日期

时间:2012-04-04 11:50:13

标签: sql sql-server-2005

我想询问如何设置输入天,月,年和周的名称的日期。这是我的例子

case when description  = 'weekly' 
        then weekly else 
case when description  = 'monthy' 
        then month else 
case when description  = 'year' 
        then year else 
case when description  = 'days' 
        then days else 
        entered 
end &DATE_D

1 个答案:

答案 0 :(得分:1)

您的个案陈述对我来说并不合适。你在寻找:

case description  
    when 'weekly' then weekly  
    when 'monthy' then month 
    when 'year' then year 
    when 'days' then days 
    else entered 
end DATE_D