In my opinon the best way of doing this would be through
an 'INSTEAD OF INSERT' trigger.
If you give a bit more on the requirements I can help with
the code, for instance can you have two of...
105,'Tom',null
105,'Tom',null
In the table ?
Peter
"Choose a job you love, and you will never have to work a
day in your life."
Confucius
>--Original Message--
>Hi
>I'm using SQL 2000,how is it possible to control a value
of column to get
>the ollowing result?
>Emp (EmpId PK,EmpName,EmpCode)
>EmpId EmpName EmpCode
>-- -- --
>100 John 3
>101 Anne 5
>102 Robert null
>103 Jennifer null
>104 Peter 78
>I want to have some NULLs or a unique number in EmpCode
column as above,
>I tried to define Uniqe index or constraint but it wasn't
successfull
>because of null,
>now how can I prevent of inserting a record of
(105,'Tom',3) and not prevent
>of inserting a record like (105,'Tom',null)
>Any help would be greatly thankful.
>
>.
>No, we can't have
> 105,'Tom',null
> 105,'Tom',null
cause the first column is a PK,
"Peter The Spate" <anonymous@.discussions.microsoft.com> wrote in message
news:204701c5141e$26f85330$a501280a@.phx.gbl...
> In my opinon the best way of doing this would be through
> an 'INSTEAD OF INSERT' trigger.
> If you give a bit more on the requirements I can help with
> the code, for instance can you have two of...
> 105,'Tom',null
> 105,'Tom',null
> In the table ?
> Peter
> "Choose a job you love, and you will never have to work a
> day in your life."
> Confucius
>
> of column to get
> column as above,
> successfull
> (105,'Tom',3) and not prevent
No comments:
Post a Comment