SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 TABLE ERRORS.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hinduson
Yak Posting Veteran

Ghana
57 Posts

Posted - 09/27/2013 :  12:11:11  Show Profile  Reply with Quote
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

USA
337 Posts

Posted - 09/27/2013 :  13:08:43  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3719 Posts

Posted - 09/27/2013 :  15:18:28  Show Profile  Reply with Quote
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

Ghana
57 Posts

Posted - 09/28/2013 :  04:41:35  Show Profile  Reply with Quote
Thanks James K .. Letme try it out

Best Regards.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000