Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 TABLE ERRORS.

Author  Topic 

Hinduson
Yak Posting Veteran

69 Posts

Posted - 2013-09-27 : 12:11:11
Please can someone help me out with how to create this table in sql.

Table : supplier.supplierDetails
*SupplierID must be auto generated.
*FirstName,LastName,Address,Phone, and Country should not be left Blank
*Phone number must be in the following format.
'[0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9]'

Best Regards.

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-09-27 : 13:08:43
For SupplierID use IDENTITY
For the name and address use NOT NULL
Sorry I cannot remember how to do the validation for the phone number.

CREATE TABLE yourtablename (SupplierID INT IDENTITY(1,1), FirstName VARCHAR(100) NOT NULL,...


djj
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-27 : 15:18:28
and for phone number column:
....,
phoneno CHAR(19)
CHECK (phoneno LIKE '[0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9]')
Go to Top of Page

Hinduson
Yak Posting Veteran

69 Posts

Posted - 2013-09-28 : 04:41:35
Thanks James K .. Letme try it out

Best Regards.
Go to Top of Page
   

- Advertisement -