Reputation: 2309
I created a database table:
I run this query
INSERT INTO dbo.Stats (Date_of_Record, Rack_Code, Total_MB, Schools_MB, Percent_Schools, Central_MB, Percent_Central)
VALUES (CAST(GETDATE() AS DATE), '78Q425', 45, 297, 1, 361, 0, 12, 0)
and I get an error
Msg 110, Level 15, State 1, Line 1
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
However, this works, but why should I NOT insert number with commas?
INSERT INTO dbo.Stats (Date_of_Record, Rack_Code, Total_MB, Schools_MB, Percent_Schools, Central_MB, Percent_Central)
VALUES (CAST(GETDATE() AS DATE), '78Q425', 45297, 1361, 0, 12, 0)
Upvotes: 0
Views: 1739
Reputation: 12804
Commas delimit values. By using commas, you are telling SQL Server to expect more columns of data. SQL Server is not white space sensitive, so white space is not used as a delimiter.
Upvotes: 2