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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle to microsoft sql syntax conversion

Status
Not open for further replies.

neroe

Technical User
Feb 27, 2003
54
GB
thanks in advance for any help on this. im a newbie to sql so this question probably is so simple for you guys.

can anyone change the syntax of this line in order for sql server 2000 to take any notice of it

constraint emp_pk primary key (emp_id);
 
Are you trying to add this PK to an existing table? If so:

Code:
ALTER TABLE emp
ADD CONSTRAINT emp_pk PRIMARY KEY (emp_id)

If not, what ARE you trying to do? ;-)

--James
 
im creating this table;

create table employee_tbl
(
emp_id varchar(9) not null,
last_name varchar(15) not null,
first_name varchar(15) not null,
middle_name varchar(15),
address varchar(30) not null,
city varchar(15) not null,
state char(2) not null,
zip number(5) not null,
phone char(10),
pager char(10),
constraint emp_pk primary key (emp_id);

its taken from a book that uses an oracle sql syntax. im altering it to sql server 2000 syntax. originally the varchar was varchar2 so i changed that. i got stuck on the primary key bit. does that make sence?
 
The syntax for the primary key part is ok but you are missing the closing ).

Also, number(5) is not a standard type. Change that to decimal(5)
 
thanks very much, that works perfectly.
 
It might be best to get a book with T-SQL syntax as Oracle syntax is very different. Also you can look up the syntax for things yourself in Books Online.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top