print "Using database ambient"
use ambient
go

print "Creating new meteo_lasilla table"
go

Create table meteo_lasilla
(
   start_date	 int  not null,
   interval	 smallint null,
   t1	         smallint null,
   t2	         smallint null,
   t3	         smallint null,
   td1	         smallint null,
   td2	         smallint null,
   rh1	         tinyint  null,
   rh2	         tinyint  null,
   pr	         int      null,
   prq	         int      null,
   wd1	         smallint null,
   wd2	         smallint null,
   ws1	         smallint null,
   ws2	         smallint null,
   ws3	         smallint null,
   wsu	         smallint null,
   wsv	         smallint null,
   wsw	         smallint null,
   dus1	 	 int      null,
   dus2	 	 int      null,
   dul1	 	 int null,
   dul2	 	 int null
)
go

print "Creating index on meteo_lasilla.start_date column"
go
create unique clustered index meteo_date 
	on meteo_lasilla ( start_date ) 
with fillfactor=100
go

print "Granting privileges on meteo_lasilla"
go
grant select on meteo_lasilla to public
grant all on meteo_lasilla to archeso
grant insert on meteo_lasilla to frameingest
go

