Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 New to programing

Author  Topic 

tkelley24
Starting Member

4 Posts

Posted - 2011-02-28 : 21:28:14
Hi all. New to SQL and to this forum. My hopes are that I can use this forum when I get stuck.. So here goes my first question.

I am currently trying to set up a table and insert some data ito it. but I keep getting an error here is the code and the error at the end ... Thank you for your help..

ALTER SCHEMA final exam OWNER TO TPKELLE;

SET search_path = finalexam, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1599 (class 1259 OID 16452)
-- Dependencies: 6
-- Name: marina; Type: TABLE; Schema: ; Owner: TPKELLE; Tablespace:
--

CREATE TABLE Rep table (
SalesRepNum int (20),
SalesRepLastName varchar (20),
SalesRepFirstName varchar (20),
Street varchar (20),
City varchar (10)
State character (2),
Zip int (5),
Commission int (10),
Rate int (15),
);


INSERT INTO REP ('35','Hull','Richard','532 Jackson','Sheldon','FL','33553',39216.00,0.07);
INSERT INTO REP ('65','Perez','Juan','1626 Taylor','Fillmore','FL','33336',23487.00,0.05);
INSERT INTO REP ('65','Perez','Juan','1626 Taylor','Fillmore','FL','33336',23487.00,0.05);


_____________________
Error message

ERROR: syntax error at or near "("
LINE 16: SalesRepNum int(20),
^

********** Error **********

ERROR: syntax error at or near "("
SQL state: 42601
Character: 319

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-28 : 21:33:36
your insert statement is wrong. It missed out the VALUEs keyword

INSERT INTO REP VALUES ('35', . . . .



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

tkelley24
Starting Member

4 Posts

Posted - 2011-02-28 : 21:49:09
Thank you ... Made the change and here is what I got..
ALTER SCHEMA finalexam OWNER TO TPKELLE;

SET search_path = finalexam, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1599 (class 1259 OID 16452)
-- Dependencies: 6
-- Name: marina; Type: TABLE; Schema: ; Owner: TPKELLE; Tablespace:
--

CREATE TABLE Rep (
SalesRepNum int (20),
SalesRepLastName varchar (20),
SalesRepFirstName varchar (20),
Street varchar (20),
City varchar (10)
State character (2),
Zip int (5),
Commission int (10),
Rate int (15),
);


INSERT INTO REP values ('35','Hull','Richard','532 Jackson','Sheldon','FL','33553',39216.00,0.07);
INSERT INTO REP values ('65','Perez','Juan','1626 Taylor','Fillmore','FL','33336',23487.00,0.05);
INSERT INTO REP values ('65','Perez','Juan','1626 Taylor','Fillmore','FL','33336',23487.00,0.05);


Error....

ERROR: syntax error at or near "("
LINE 16: SalesRepNum int (20),
^


********** Error **********

ERROR: syntax error at or near "("
SQL state: 42601
Character: 319
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-28 : 22:07:42
those error message doesn't seems like coming from SQL Server

are you using SQL Server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -