在下表中,我有一个表名UserGroupMapTable
下面列出了列,当我插入它时它的数据类型会抛出错误
转换varchar值时转换失败'2014-03-07 10:48:06'到数据类型int
请帮我这样做。
Column Datatype
UserID int
GroupID int
CreatedBy int
CreatedOn DateTime
ModifiedBy int
ModifiedOn Datetime
INSERT INTO UserGroupMapTable(UserID,GroupID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn) VALUES ((SELECT UserID FROM UserTable WHERE UserFirstName = 'Bhupinder'),(SELECT GroupID FROM GroupsTable WHERE GroupName = 'ReconciliationAdmin'),'2014-03-07 10:48:06' ,1,'2014-03-07 10:48:06',1)
答案 0 :(得分:1)
更改插入列表中的订单ModifiedOn
和ModifiedBy
,如下所示
INSERT INTO UserGroupMapTable(UserID,GroupID,CreatedOn,CreatedBy,ModifiedOn,ModifiedBy)
VALUES ((SELECT UserID FROM UserTable WHERE UserFirstName = 'Bhupinder'),(SELECT GroupID FROM GroupsTable WHERE GroupName = 'ReconciliationAdmin'),'2014-03-07 10:48:06' ,1,'2014-03-07 10:48:06',1)