user1279144
user1279144

Reputation: 43

SQL Server Express - Incorrect Syntax near ','

I am getting an anoying error on this simple sql and I can't spot the error, any help will be appretiated.

CREATE TABLE alertitem 
    ([id] INT, 
     [dateposted] DATETIME, 
     [daterevised] DATETIME, 
     [datestart] DATETIME, 
     [dateexpires] DATETIME, 
     [userid] INT, 
     [title] VARCHAR(MAX), 
     [details] VARCHAR(MAX), 
     [lat] DOUBLE, 
     [lon] DOUBLE, 
     [radius] INT, 
     [imageid] INT);

Upvotes: 2

Views: 4348

Answers (4)

WebMasterP
WebMasterP

Reputation: 518

Double isn't a SQL Server datatype.

This should be a complete list of all the data types, see MSDN.

I should note, you'll probably want to use FLOAT or DECIMAL to solve your problem, but I don't know anything about the rest of what you're doing (producers or consumers), so I'll let you pick which data type will solve your problem.

Upvotes: 8

Michael Capobianco
Michael Capobianco

Reputation: 812

You simply needed to remove DOUBLE, as it's not a supported data type. I'd also reccomend organizing your query in a more easy to read manner such as:

CREATE TABLE alertitem (
    [id] INT,
    [dateposted] DATETIME,
    [daterevised] DATETIME,
    [datestart] DATETIME,
    [dateexpires] DATETIME,
    [userid] INT,
    [title] VARCHAR(MAX),
    [details] VARCHAR(MAX),
    [lat] FLOAT,
    [lon] FLOAT,
    [radius] INT,
    [imageid] INT);

You'll find it easier to troubleshoot bugs this way.

Upvotes: 1

Darren
Darren

Reputation: 70748

Use decimal(9,2) or the precision you require rather than DOUBLE

Upvotes: 3

NoAlias
NoAlias

Reputation: 9193

Change DOUBLE to FLOAT to fix your problem.

Upvotes: 6

Related Questions