首页 > 解决方案 > 如何将信息插入到 SQL 中同一记录的不同列中?

问题描述

我想使用 VBA 在表中创建一条记录,并添加与不同列中的记录有关的不同信息。

目前,我的代码创建了一条新记录并为其命名。现在在同一条记录下,我想添加一个地址。如何才能做到这一点?

在这里,我的代码将值“Testing VB”插入到表 customer 中的 Name 中。如何向同一客户添加地址?

sSQL = "Insert into customer (Name) values ('Testing VB')"

标签: sql

解决方案


如果你想同时插入

Insert into customer (Name, Address) values ('Testing VB', 'My address')

如果要在执行插入后添加,则需要更新

 update customer 
 set address = 'My Addres'
 where Name  = 'Testing VB'

推荐阅读