how do I make a table that is creating itself from another table in SQL Server -


table of self creates trestituiri timprumuturi

create table timprumuturi (  id_imprumut int identity primary key,  dataimprumut date default getdate(),  datascadenta (dateadd(day,5,dataimprumut)) persisted,  codcd char(10) foreign key references tcd(codcd)not null,  codcv char(10) foreign key references tcasetevideo(codcaseta),  codab char(10) foreign key references tabonati(codabonat) not null,  constraint uccodcd unique (codcd, codcv),   constraint uccodcv unique (codcd, codab),   constraint uccodab unique (codcv, codab)  ) 

i want trestituiri contain columns like:

trestituiri (  id_restituire int identity primary key,  datarestituire // should equal datascadenta timprumuturi  codcd char(10) foreign key references tcd(codcd),  codcv char(10) foreign key references tcasetevido(codcaseta),  codab char(10) foreign key references tabonati(codabonat) )  

but trestituiri have contain values timprumuturi datascadenta not older current time {getdate()}-60 days** *i mean values timprumuturi datascadenta not less current time -2 months *

insert trestituiri (datarestituire,codcd , codcv,codab) select datascadenta,codcd , codcv,codab timprumuturi datascadenta>getdate()-60 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -