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);
1

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

It worked, Thanks, I was using the same syntax as MySQL which uses DOUBLE as a data type.
6

Change DOUBLE to FLOAT to fix your problem.

Comments

3

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.