create database table

in sql 2000 server, how to create a database let's say "XY" and a table called "Z" with fields such "Z1", "Z2" and "Z3"?.
[126 byte] By [coolhead] at [2007-11-19 2:38:13]
# 1 Re: create database table
Provided you have the authority to do so, you can use the Create Table command.

Create Table XY
(CustomerId Int Not Null Primary Key,
CustomerName Char(50) Not Null,
CustomerContact Char(50),
CustomerAddress1 Char(50) Not Null,
CustomerAddress2 Char(50) Not Null,
CustomerAddress3 Char(50) Not Null,
CustomerAddress4 Char(50),
CustomerAddress5 Char(50))

Heres one that I create (using VB, so just remove all the quotes and &_ to get the line), which creates a primary key and a foreign key.

20 sqlStmt = "Create Table " & tblName2 & " (" & _
"PrjId Char(20) Not Null, " & _
"PrjDesc Char(100) Not Null, " & _
"PayRate Real Not Null, " & _
"CustomerId Int Not Null, " & _
"Constraint " & _
tblName2 & "PK Primary Key (PrjId), " & _
"Constraint " & _
tblName2 & "FK1 Foreign Key (CustomerId) References " & tblName1 & " (CustomerId))"

HTH
jp140768 at 2007-11-9 13:39:09 >