title: SQL Server - Add Constraint for existing table using Alter Table function
body: <p>I got a little trouble with SQL. This is the table Customers :</p>
  
  <pre><code>ID      Name     Address                Phone
  KP001   Bill     Jl Bali NO 27          81976524451
  KP002   Jane     Jl Sandang NO 5        81876537521
  KP003   Dion     Jl Kebon Jeruk NO 7    81684234913
  </code></pre>
  
  <p>the original structure table Customer :</p>
  
  <pre><code>CREATE TABLE Customer
  (
  ID char(5)primary key not null,
  Name varchar(20),
  Address varchar(30),
  Phone varchar(12),
  constraint cs2 check (LEN(ID)=5),
  constraint cs3 check (ID like 'KP[0-9][0-9][0-9]'),
  )
  </code></pre>
  
  <p>and I want to change table structure using Alter Table. I want to Add constraint to table Customers which Address after the 'no' must be a number.</p>
  
  <p>First, in Indonesia there are street names using the 'NO' as an indicator street number. And requires the Customer table after the 'NO' is a number. I've tried with this query :</p>
  
  <pre><code>ALTER TABLE Customers WITH NOCHECK
  ADD CONSTRAINT cs_address 
  CHECK (CHARINDEX('no',Address)&gt;1 AND
  ISNUMERIC ( SUBSTRING (Address,7,2)) =1)
  </code></pre>
  
  <p>I know the query incorrect, but can you help me to fix the error and get the right results?</p>
  
  <p>*sorry if my english is not good</p>