Hey guys i'm trying to use a DATEDIFF function by calling GETDATE within the DATEDIFF function. I get the error above when i try to insert into the SQL view. I know if i save the view and then create another view and reference the first view it will work. Is there a way to just use one view instead of two? I've copied my SQL view below:
SELECT dbo.tarCustomer.CustName, dbo.tarCustLastTran.TranDate, dbo.tarCustLastTran.TranType, dbo.tarCustLastTran.TranID, GETDATE() AS Date2,
DATEDIFF(m,TranDate,'DATE2')
FROM dbo.tarCustLastTran INNER JOIN
dbo.tarCustomer ON dbo.tarCustLastTran.CustKey = dbo.tarCustomer.CustKey
WHERE (dbo.tarCustLastTran.TranType = 501)
Thanks for your help.
SA
SELECT dbo.tarCustomer.CustName, dbo.tarCustLastTran.TranDate, dbo.tarCustLastTran.TranType, dbo.tarCustLastTran.TranID, GETDATE() AS Date2,
DATEDIFF(m,TranDate,'DATE2')
FROM dbo.tarCustLastTran INNER JOIN
dbo.tarCustomer ON dbo.tarCustLastTran.CustKey = dbo.tarCustomer.CustKey
WHERE (dbo.tarCustLastTran.TranType = 501)
Thanks for your help.
SA