SQL Server 中的 INSERT INTO 语句 [英] INSERT INTO statement in SQL Server

查看:34
本文介绍了SQL Server 中的 INSERT INTO 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将信息输入到名为 Food_Log 的表中.

I am trying to enter information into my table named Food_Log.

INSERT INTO Food_Log
(Person, Food, ServingSize, Date, Meal);
VALUES
(John,'Cheerios',2,'1-APR-2014','Breakfast');

由于此条目,我收到以下错误.

I am getting the following error because of this entry.

消息 102,级别 15,状态 1,第 2 行
';' 附近的语法不正确.

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ';'.

不知道该怎么做才能解决这个问题.

Not sure what to do in order to get around this.

推荐答案

去掉VALUES

INSERT INTO Food_Log (Person, Food, ServingSize, Date, Meal)
VALUES ('John','Cheerios',2,'2014-04-01','Breakfast');

日期格式通常是YYYY-MM-DD.你忘记了 John

And date format is normally YYYY-MM-DD. And you forgot the quotes around John

这篇关于SQL Server 中的 INSERT INTO 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆