如果还有关于T-SQL的陈述? [英] IF Else Statement on T-SQL ?
本文介绍了如果还有关于T-SQL的陈述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好我正在尝试检查发票交付,如果它是在sql查询中准时,迟到或截止日期,即时使用SQL Server。如何在我的t-sql上实现if语句?
' 检查发票日期和截止日期
如果table1.invoiceDate< = table2.dueDate然后
'已交付'
end if if
if table1.invoiceDate> = table2.dueDate then
'延迟交货'
end if if
IF table2.dueDate< = CONVERT (VARCHAR,GETDATE(),110)然后
' 到期'
end if if
解决方案
完整的解释如何使用IF ... ELSE ..在T-SQL中可以使用
http://technet.microsoft.com/en-us/library/ms182587.aspx [ ^ ]
希望这个帮助
Hi everyone I'm trying to check invoice delivery if it's 'on time','late' or 'due date' in sql query, im using SQL Server. how can i implement if statement on my t-sql?
'check nvoice date and due date
IF table1.invoiceDate <= table2.dueDate then
'delivered'
end if
if table1.invoiceDate >= table2.dueDate then
'Late Delivery'
end if
IF table2.dueDate <= CONVERT(VARCHAR,GETDATE(),110) then
'on due'
end if
解决方案
A complete explanation of how to use IF...ELSE.. in T-SQL is available here
http://technet.microsoft.com/en-us/library/ms182587.aspx[^]
Hope this Helps
这篇关于如果还有关于T-SQL的陈述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文