I am not sure what is wrong when I declare these variables in SQL

I have the following code:

USE pricingdb go CREATE TABLE dbo.Events_060107_2012 ( Date_Time varchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, Event_Type TEXT, Month_of_Year TEXT, Survey DOUBLE, Actual DOUBLE, Prior_Data DOUBLE, Revised DOUBLE, Relevance FLOAT, Ticker TEXT ); 

Go

And I get the error message:

 "Incorrect syntax near ','. Level 15, State 1, Line 6" 

I know that this should be a fairly simple problem to fix, but for some reason I had trouble understanding how to fix it. My knowledge of SQL is, at best, a beginner, so most of the other threads that I read were a bit above my head.

Thanks in advance for your help.

+4
source share
3 answers

DOUBLE is not a valid data type on sql server

Use float, numeric, ... or any of the supported types.

Additional information at http://msdn.microsoft.com/en-us/library/ms187752.aspx

+13
source

Use float instead of double (or decimal)

 USE pricingdb go CREATE TABLE dbo.Events_060107_2012 ( Date_Time varchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, Event_Type TEXT, Month_of_Year TEXT, Survey FLOAT, Actual FLOAT, Prior_Data FLOAT, Revised FLOAT, Relevance FLOAT, Ticker TEXT ); 
0
source

Two questions. Firstly, there is no double data type. Secondly, the float takes a size to indicate the difference in accuracy. Equivalent create request to the above:

 CREATE TABLE dbo.Events_060107_2012 ( Date_Time varchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, Event_Type TEXT, Month_of_Year TEXT, Survey FLOAT(53), Actual FLOAT(53), Prior_Data FLOAT(53), Revised FLOAT(53), Relevance FLOAT(24), Ticker TEXT ); 
0
source

Source: https://habr.com/ru/post/1416223/


All Articles