2017 Dec 24 7:26 PM
According to the documentation. using sp_addtype, we specifying null type The null type determines how the user-defined datatype treats nulls. You can create a user-defined datatype with a null type of “null”, “NULL”, “nonull”, “NONULL”, “not null”, or “NOT NULL”.
However, It seems NONULL or NOT NULL provided in the type definition will not prevent the type from accepting the null value. Any idea?
My test is like the following. There is no error raised when assign, the new type variable can have NULL value assigned to it.
Thank you very much.
ASE 16
1> sp_addtype nm , "varchar(20)", "NONULL"
2> go Type added.
(return status = 0)
1> declare @ss nm
2> select @ss = null
3> go
(1 row affected)
1> declare @ss nm
2> select @ss = null
3> select isnull(@ss,"NULLVAL")
4> go
(1 row affected)
----------------------------------------
NULLVAL (1 row affected)
According to the documentation. using sp_addtype, we specifying null type The null type determines how the user-defined datatype treats nulls. You can create a user-defined datatype with a null type of “null”, “NULL”, “nonull”, “NONULL”, “not null”, or “NOT NULL”.
However, It seems NONULL or NOT NULL provided in the type definition will not prevent the type from accepting the null value. Any idea?
My test is like the following. There is no error raised when assign, the new type variable can have NULL value assigned to it.
Thank you very much.
ASE 16
1> sp_addtype nm , "varchar(20)", "NONULL"
2> go Type added.
(return status = 0)
1> declare @ss nm
2> select @ss = null
3> go
(1 row affected)
1> declare @ss nm
2> select @ss = null
3> select isnull(@ss,"NULLVAL")
4> go
(1 row affected)
----------------------------------------
NULLVAL (1 row affected)
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |