dbTalk Databases Forums  

Domain for numbers.

comp.databases.theory comp.databases.theory


Discuss Domain for numbers. in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Naga lenoj
 
Posts: n/a

Default Domain for numbers. - 01-17-2008 , 06:20 AM






Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).

Reply With Quote
  #2  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM







"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #3  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #4  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #5  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #6  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #7  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #8  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #9  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 06:59 AM




"Naga lenoj" <nagalenoj (AT) gmail (DOT) com> wrote

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
Haven't you heard of a check constraint?





Reply With Quote
  #10  
Old   
Bob Badour
 
Posts: n/a

Default Re: Domain for numbers. - 01-17-2008 , 07:45 AM



Naga lenoj wrote:

Quote:
Actually, i have a need to store the numbers like "AS2303",
TS3381"(first 2 alphabets,next 3 numbers). What i want is, i have to
assign the integrity which can check the following values,
23334, ASDER, SDE23, 233A4 and like this.
If i assign as a character type domain.Then i can't check the above
cases.
Can anyone help me?
I am using postgresql(for your information).
If I recall correctly, postgresql has some support for regular expressions:
http://www.postgresql.org/docs/8.1/s...-matching.html

Does it support general constraints with a CHECK keyword? Yes it does:
http://www.postgresql.org/docs/8.1/s...nstraints.html


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.