By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Insert all sundays and second saturdays in a holiday table.

P: 2
Dear All,
I have a holiday table and i need to insert all sundays and second saturdays into the table using a stored procedure.There are 4 columns in the table such as holiday_id,holiday_date,updated_on and updated_by.Please guide me.I am a fresher in this field..
Nov 27 '12 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 5,387
Bytes is not a code writing nor homework service. However, if you will provide the work you've already attempted someone here might be able to point you in the correct direction.
Nov 27 '12 #2

P: 2
This is my code.It displays all sundays but it shows second saturdays only for the first 3 months.From April it is irregular and showing 1st 3rd saturdays.

Expand|Select|Wrap|Line Numbers
  1. select to_date(to_char(d, 'YYYY-MM-DD'),'YYYY-MM-DD') from generate_series('2012-01-01'::date, '2012-12-31','1day') g(d) where extract(dow from d) = 0 or (extract(dow from d) = 6 and extract(week from d)::int % 2 = 0 and extract(week from d)::int % 4 <> 0);
Please anyone guide me..
Dec 4 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.