Answered by:
Dateadd producing no results in Declaration Start

Question
-
The sql below returns null in the Declaration Start allias
The value of TaxYearDate.StartDate date/time is 6/04/2015
SELECT "SMS_" & sms_remittance.[Transaction ID] AS ImportID, sms_remittance.[Transaction ID], [sms_remittance.Transaction Date], sms_remittance.Title, sms_remittance.[First Name], sms_remittance.Surname, sms_remittance.[Address 1], sms_remittance.[Address 2], sms_remittance.Town, sms_remittance.Postcode, sms_remittance.Country, "Mobile" As [Phone Type], sms_remittance.Mobile, "Mail Type" AS MailType, IIf([gad dpa]=-1,'All',IIf([gad dpa]=0,'Do Not Contact','')) AS MailTypeDesc,
[sms_remittance.Transaction Date] AS MailTypeDate, [sms_remittance.Payment Date] AS [Gift Date], sms_remittance.Keyword,sms_remittance.Amount,sms_remittance.Mobile AS [Gift Reference Number], "No" AS [Gift Anonymous], "Electronic" AS DeclarationIndicator, "R-R050-1503-ST01" AS DeclarationSource,[sms_remittance.Transaction Date] AS DeclarationMade, DateAdd("yyyy",-4,TaxYearDate.StartDate) AS [Declaration Start] ,"Yes" AS PaysUKTaxFROM sms_remittance,TaxYearDate
- Changed type ParkinsonsDB Sunday, August 2, 2015 12:40 PM
- Moved by litdev Monday, August 3, 2015 10:49 AM
- Changed type ParkinsonsDB Wednesday, August 5, 2015 8:35 PM remove
Sunday, August 2, 2015 12:37 PM
Answers
-
Assuming the data source is SQL Server I'd try over here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.Tuesday, August 4, 2015 1:10 AM
All replies
-
Assuming the data source is SQL Server I'd try over here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.Tuesday, August 4, 2015 1:10 AM -
How can I close or drop this question from forum as I'm unable to find anywhere that tells me.Wednesday, August 5, 2015 8:38 PM
-
How can I close or drop this question from forum as I'm unable to find anywhere that tells me.
Well, if the question is related to SQL you can ask in the forum Dave suggests.
If it's not, you can explain what you are trying to ask and we can further assist you.
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})Thursday, August 6, 2015 7:34 PM