vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi,
We have a SAS PROC SQL table like below, with one column
Code: |
Table : dreams
Var1
1
2
3
4
5 |
The requirement is to enforce a integrity constraint on the table, so that the value of any new row inserted can only be max(var1) + 1.
i.e. For the above shown table, the table has to accept only insert statement only if Var1 = 6. Subsequent insert statement has to accept only Var1 = 7.
Code: |
proc sql;
create table dreams (var1 num);
insert into dreams
set var1 = 1
set var1 = 2
set var1 = 3
set var1 = 4
set var1 = 5
;
quit;
proc sql;
alter table dreams
add constraint cons_var1 check(SOME CONDITION REQUIRED?);
quit; |
Could you please let me know how we can do this, or any other alternative method of achieving this.
Thanks, |
|