插入查询,在插入小日期时间值时显示错误语法错误

时间:2022-11-08 19:17:57

i want to insert a record with small date time .createddate is small date time data type. error - "Incorrect syntax near '2017-10-06 16:43:10'.". data type - smalldatetime

我想插入一个日期时间较短的记录.createddate是一个小日期时间数据类型。错误 - “2017-10-06 16:43:10附近的语法错误。”。数据类型 - smalldatetime

 INSERT INTO [dbo].[Users]
           ([UserID]
           ,[FullName]
           ,[Username]
           ,[Password]
           ,[City]
           ,[Phone]
           ,[Status]
           ,[CreatedDate])
     VALUES
           (2
           ,'krisha mohan'
           ,'krishna'
           ,'krishna@123'
           ,'hyderabad'
           ,'868613986'
           ,1
           ,'2017-10-06 16:43:10'
GO

1 个解决方案

#1


0  

you are missing closing parenthesis ")" just before the Go statement.

你在Go语句之前缺少右括号“)”。

here is your query will look like.

这是你的查询看起来像。

INSERT INTO [dbo].[Users]
       ([UserID]
       ,[FullName]
       ,[Username]
       ,[Password]
       ,[City]
       ,[Phone]
       ,[Status]
       ,[CreatedDate])
 VALUES
       (2
       ,'krisha mohan'
       ,'krishna'
       ,'krishna@123'
       ,'hyderabad'
       ,'868613986'
       ,1
       ,'2017-10-06 16:43:10'
       )
GO

#1


0  

you are missing closing parenthesis ")" just before the Go statement.

你在Go语句之前缺少右括号“)”。

here is your query will look like.

这是你的查询看起来像。

INSERT INTO [dbo].[Users]
       ([UserID]
       ,[FullName]
       ,[Username]
       ,[Password]
       ,[City]
       ,[Phone]
       ,[Status]
       ,[CreatedDate])
 VALUES
       (2
       ,'krisha mohan'
       ,'krishna'
       ,'krishna@123'
       ,'hyderabad'
       ,'868613986'
       ,1
       ,'2017-10-06 16:43:10'
       )
GO