2

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);
Darren
  • 68,902
  • 24
  • 138
  • 144
user1279144
  • 43
  • 2
  • 5
  • 1
    [What represents a double in sql server?](http://stackoverflow.com/questions/1209181/what-represents-a-double-in-sql-server) – Tim Lehner Mar 28 '12 at 21:17

4 Answers4

8

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
WebMasterP
  • 518
  • 4
  • 8
6

Change DOUBLE to FLOAT to fix your problem.

NoAlias
  • 9,218
  • 2
  • 27
  • 46
3

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

Darren
  • 68,902
  • 24
  • 138
  • 144
1

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.