Home changing step in the loop T-SQL
Reply: 0

changing step in the loop T-SQL

user674 Published in March 24, 2018, 12:38 am

Hello. I have some trouble. I have a table with dates for 4 years. I need to run loop through it using a day value = 7, month value = 30 and years = 365. How can I change this value inside the loop?

WHILE @start_date <= @finish_date
        SET @start_date = @start_date + 1

I would like to get changing value @start1 = 7 + 1; @start1 = 30 + 1 and @start1 = 365 + 1. I think it's possible, but I haven't any idea (haven't any working idea at the moment)

I was trying to use CASE construction, but when I ran it - my DBeaver application was shut down immediately.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297669 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO