Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SCRIPT: Create A Table SQL Server 7.0

Status
Not open for further replies.

SuperGrover

Programmer
Oct 29, 2002
5
US
Hello.

I am extremely new to SQL Server 7.0.
I am trying to write an SQL script to create
a new table within a Database.

I have absolutely no idea how to define a numeric field as both a primary field and an auto-number field (I mean that the records are automatically numbered). If somebody could help me, I would appreciate it very much.

I have also had incredible trouble trying to find any documentation about Table creation on the net.
Does anyone know of a very basic tutorial or site online. As I really need to know how to define different types of data such as datetime, integers etc.

 
Do you have the SQL electronic books called Books Online? They should be available on the SQL installation CD. If not you can download the setup file from Microsoft.


The simple syntax for creating a table is...

CREATE TABLE jobs
(job_id int IDENTITY(1,1) PRIMARY KEY CLUSTERED,
job_desc varchar(50) NOT NULL,
min_lvl tinyint NOT NULL,
max_lvl tinyint NOT NULL)

job_id is the primary key and it will automatically increment from 1 by 1. Terry

The reason why worry kills more people than work is that more people worry than work. - Robert Frost
 
Thank you Terry.

I downloaded the files and your example, they have been very helpful.

Ross
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top