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
 creating a table problems

Author  Topic 

danielpnowak
Starting Member

2 Posts

Posted - 2014-11-28 : 17:32:53
Hi - I'm new to SQL and am having problems creating a table in my first database.

When I script:

CREATE TABLE ship (mmsi INT, time INT, longitude INT, latitude INT, cog INT, sog INT, heading INT, navsat INT, imo INT, name CHAR, callsign VARCHAR, type INT, a INT, b INT, c INT, d INT, draught INT, dest CHAR, eta INT); I am returned with an error 1064 with regads to the attributes from "Typ" onwards.

From what I can see this should work.

Any pointers?

Many thanks, Dan

mandm
Posting Yak Master

120 Posts

Posted - 2014-11-29 : 05:25:20
I Googled the error you posted and it looks like this is MYSQL. Be aware that this forum is for Microsoft SQL Server and the folks here may or may not be able to help with MYSQL. That said I searched the MYSQL create table command and found the following example. The problem may be that you have not defined the sizes for the CHAR and VARCHAR fields.

CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
-> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
Go to Top of Page

danielpnowak
Starting Member

2 Posts

Posted - 2014-11-29 : 07:42:53
that was simple! and slightly embaressing... thanks for the help.
Go to Top of Page

mandm
Posting Yak Master

120 Posts

Posted - 2014-11-29 : 11:08:27
You're welcome
Go to Top of Page
   

- Advertisement -