drop table Data;
CREATE TABLE Data (
	id int PRIMARY KEY IDENTITY(1,1),
	data date NOT NULL,
	datastring char(10) NOT NULL,
	rok char(4) NOT NULL,
	miesiac char(2) NOT NULL,
	dzien char (2) NOT NULL,
	miesiacNazwa varchar(16) NOT NULL,
	dzienTygodniaNazwa varchar(16) NOT NULL,
	kwartal char(1) NOT NULL
);

CREATE TABLE Data0 (
	id int PRIMARY KEY IDENTITY(1,1),
	data date NOT NULL)

declare @startDate Date;
declare @endDate Date;
declare @offset Date;

select @startDate = '1999/01/01';
select @endDate = '2111/01/01';
select @offset = @startDate;
while @offset < @endDate begin
insert into data(data, datastring, rok, miesiac, dzien, miesiacNazwa, dzienTygodniaNazwa, kwartal) 
values(@offset, CONVERT(varchar, @offset, 105), YEAR(@offset), MONTH(@offset), DAY(@offset), DATENAME(month, @offset), DATENAME(weekday, @offset), DATENAME(q, @offset) );
select @offset = dateadd(day, 1, @offset);
print @offset;
end

select * from data

