x

sql code that give this error

CREATE TABLE  Payroll(                    
    Emp_NINO    VARCHAR (13) NOT NULL,                    
    Mth_Shifts  NUMERIC (2) NOT NULL,                    
    Pay_Rate        NUMERIC (2) NOT NULL,                    
             Emp_Mth_Salary NUMERIC (5) NOT NULL,                     
-- This indicates which attribute(s) uniquely identify each row of data.                    
CONSTRAINT  pk_ Payroll  PRIMARY KEY (Mth_Shifts, Pay_Rate));                    

i wrote the code and the error that appears on my screen is "missing right paranthesis".i'm trying to understand where is the error!!!!!!Thx a lot!

more ▼

asked Apr 14, 2010 at 01:19 PM in Default

avatar image

vio
1 2 4 4

is this SQL Server or Oracle?

Apr 16, 2010 at 07:31 PM Nathan Skerl
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

Try to format the code properly, oppening and closing brackets of CREATE TABLE in separate lines. It will be easier for you to find the problem. I see there is a space in the name of the constraint, and if the command is not formatted correctly, inline comment may affect the syntax. I find this much cleaner:

CREATE TABLE Payroll            
(             
Emp_NINO VARCHAR (13) NOT NULL,             
Mth_Shifts NUMERIC (2) NOT NULL,             
Pay_Rate NUMERIC (2) NOT NULL,             
Emp_Mth_Salary NUMERIC (5) NOT NULL,             
-- This indicates which attribute(s) uniquely identify each row of data.             
CONSTRAINT pk_Payroll PRIMARY KEY (Mth_Shifts, Pay_Rate)            
);            

You should use this '101010' icon to indicate that part of your post is code actually, then the formatting will be easier. I found that line breaks do not work very well in this editor.

The above command works on my machine.

more ▼

answered Apr 14, 2010 at 02:44 PM

avatar image

Piotr Rodak
262 2 4

(comments are locked)
10|1200 characters needed characters left

plz format u r code properly if not necessaary romeve the comment line

CREATE TABLE Payroll ( Emp_NINO VARCHAR (13) NOT NULL, Mth_Shifts NUMERIC (2) NOT NULL, Pay_Rate NUMERIC (2) NOT NULL, Emp_Mth_Salary NUMERIC (5) NOT NULL, -- This indicates which attribute(s) uniquely identify each row of data. CONSTRAINT pk_Payroll PRIMARY KEY (Mth_Shifts, Pay_Rate) );

more ▼

answered Apr 19, 2010 at 10:32 AM

avatar image

user-1130 (google) 1
1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2170
x18

asked: Apr 14, 2010 at 01:19 PM

Seen: 884 times

Last Updated: Apr 19, 2010 at 12:42 PM

Copyright 2017 Redgate Software. Privacy Policy