
TSQL script to add re-occurring rows within next 30 years
- or -
Post a project like this1435
£40(approx. $54)
- Posted:
- Proposals: 8
- Remote
- #3310807
- Awarded
ASP.NET MVC | C# |VB.NET | Kentico | React Native | Web API | Angular | React.JS | Android | IOS | Swift

Professional Digital Marketer | Web Development | IOS and Android Developer | WordPress | React Native | Video Editor | Graphic Designing

WEBSITE DEVELOPMENT & DESIGN ! WORDPRESS ! JAVA ! PHP ! JAVASCRIPT ! GRAPHIC DESIGN | VIDEO | EXCEL VBA & MACRO EXPERT

Senior Developer / Solution Architect / Database Expert / System Integration specialist
22990232274804562314854553942561066205833317425861100119





Description
Experience Level: Entry
I need a TSQL (SQL Server 2016) script written to list components that will reoccur in the next 30 years. I will put this query in SSRS so needs to be simple but robust.
For example component A has a lifecycle of 6 years with the current programme year of 2025, it will need to list additional rows in my query programme years 2031, 2037, 2046.
*lifecycle is a field, programme year is a field.
This is the existing query and new query must be dynamic as programme years can change.
select
[Component Description]
,case when nullif([Progamme Year],'') is null then
year(DateAdd(yy, Lifecycle, Cast([Installation Date] As date)))
else [Progamme Year] end [Progamme Year]
,Lifecycle
,cast(replace(nullif([Total Cost per install],''), '£','') as decimal(10,2))[Total Cost per install]
from [DBAdmin].[dbo].[AssetsDwellingBusinessNewPlan]
PLease see existing sample and output required.
Attachment: Items in white background are from the table, item in yellow is an example used, items in red are the expected output.
The output should also include programme years that have no costs against them, so 2020, 2021 etc.
Happy to provide further details.
For example component A has a lifecycle of 6 years with the current programme year of 2025, it will need to list additional rows in my query programme years 2031, 2037, 2046.
*lifecycle is a field, programme year is a field.
This is the existing query and new query must be dynamic as programme years can change.
select
[Component Description]
,case when nullif([Progamme Year],'') is null then
year(DateAdd(yy, Lifecycle, Cast([Installation Date] As date)))
else [Progamme Year] end [Progamme Year]
,Lifecycle
,cast(replace(nullif([Total Cost per install],''), '£','') as decimal(10,2))[Total Cost per install]
from [DBAdmin].[dbo].[AssetsDwellingBusinessNewPlan]
PLease see existing sample and output required.
Attachment: Items in white background are from the table, item in yellow is an example used, items in red are the expected output.
The output should also include programme years that have no costs against them, so 2020, 2021 etc.
Happy to provide further details.

Javed I.
100% (3)Projects Completed
2
Freelancers worked with
2
Projects awarded
20%
Last project
30 Jun 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
please are you running it through a program like vb or through MSSSQL?
Javed I.17 Jun 2021I'll be using the script in SSRS, but needs to be developed in SSMS
987238
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies