我可以像在t-sql中一样使用嵌套的Case语句,并且在访问查询中使用“*”也可以在T-sql中以相同的方式使用它,例如
([Col2]*[col3])
MS Access:
IIf(IsNull([Col1]),([Col2]*[col3]),([col2]*[col3]/[col1])) as Column
T-SQL:
Case When [Col1] Is Null then ([Col2]*[col3])
else ([col2]*[col3]/[col1]) end AS column
Ms Access:
IIf(Left([col],1)=3,"Tran",IIf(Left([ss],1)=7,"Con","Sto")) AS [col]
T-SQL:
(Case When (Left([col],1)=3) then 'Tran' else (Case When (Left([col],1)=7) then 'Con' else 'Sto' end )end) AS [col type]
答案 0 :(得分:1)
你的第二个TSQ应该是这样的:
CASE
WHEN LEFT([col],1)=3 THEN 'Tran'
WHEN LEFT([col],1)=7 THEN 'Con'
ELSE 'Sto'
END AS [col type]
就#
而言,在SQL中不需要它,只需将日期值放在正确格式化的单引号中。