문제

I'm trying to define a domain which will allow to pass only 6 chars strings. I'm declaring it in a following way:

create domain aircrafts_reg_nos as char(6)
check(length(@value) = 6)

But this doesn't seem to catch strings which are longer than 6 chars. Is there a way to enforce it?

도움이 되었습니까?

해결책

length is not a Sybase SQL function. To find the length of a character field, use *char_length*. So your code should probably look something like this.

create domain aircrafts_reg_nos as char(6)
check(char_length(@value) = 6)

Also, try to do a little more research to make sure you are using the right function names in your code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top