在 excel 2002 中将文本字符串附加到列的所有单元格的左侧?

发布于 2024-08-07 16:18:46 字数 411 浏览 3 评论 0原文

我有两列,有两个值。我想在 A 列所有单元格的左侧附加一些文本,并连接到 B 列所有单元格的右侧。

基本上,我试图避免键入一大堆sql更新。例如,如果我有一个

ID 为员工姓名的 Excel
135 拉斯普京
76 Bush

我想生成这样的东西

UPDATE EMPLOYEES SET ID = '135', WHERE employee_name= 'RASPUTIN'
UPDATE EMPLOYEES SET ID = '76', WHERE employee_name= 'BUSH'

那么也许有一个解决方案,将文本附加到单元格,然后合并行?

我更喜欢内置函数,因为我不熟悉 VBA,谢谢!

PS 在超级用户上交叉发布,但尚未回复。

I have two columns with two values.. I want to append some text to the left of all the cells of Column A and concatenate to the right of all the cells of Column B.

Basically I'm trying to avoid having to type in a whole bunch of sql updates. so for example if i have an excel with

ID Employee Name
135 Rasputin
76 Bush

I want to generate something like this

UPDATE EMPLOYEES SET ID = '135', WHERE employee_name= 'RASPUTIN'
UPDATE EMPLOYEES SET ID = '76', WHERE employee_name= 'BUSH'

So perhaps a solution of appending text to the cells and then merging the rows?

I prefer a built in function as I'm not familiar with VBA thanks!

PS crossposted on superuser but no response yet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

花落人断肠 2024-08-14 16:18:46

您不能在 C1 列中创建一个公式,其内容如下:

="UPDATE EMPLOYEES SET ID ='" & A1 & "', WHERE employee_name = '" & B1 & "'"

然后将该公式复制下来。然后您应该能够将其剪切并粘贴到您的 SQL 查询应用程序中。

Can't you create a formula in column C1 which says something like:

="UPDATE EMPLOYEES SET ID ='" & A1 & "', WHERE employee_name = '" & B1 & "'"

And then copy that formula down. You should then be able to cut and paste that into your SQL query application.

未蓝澄海的烟 2024-08-14 16:18:46

Excel中有一个CONCATENATE函数...我已经多次使用这个函数来根据Excel电子表格数据生成SQL查询

如果您的Id列是A并且您的名字在B中,则此代码可以工作


=CONCATENATE("UPDATE EMPLOYEES SET ID = '",A1,"', WHERE employee_name= '",B1,"'")

There is a CONCATENATE function in Excel.... I've used this function many times to generate SQL queries based on Excel spreadsheet data

This code works provided your Id column is A and your name is in B


=CONCATENATE("UPDATE EMPLOYEES SET ID = '",A1,"', WHERE employee_name= '",B1,"'")
提笔书几行 2024-08-14 16:18:46

如果我理解正确的话:

="UPDATE EMPLOYEES SET ID = '" & A2 & "', WHERE employee_name = '" & B2 & "'"

应该是你想要的(假设 id 位于 A 列,名称位于 B 列)。

If I understand correctly:

="UPDATE EMPLOYEES SET ID = '" & A2 & "', WHERE employee_name = '" & B2 & "'"

should be what you want (assuming the id is in column A and the name in column B).

墨落画卷 2024-08-14 16:18:46

在超级用户中正确回答 https://superuser.com/questions/55262/append-a-text-string-to-the-left-of-all-the-cells-of-a-column-in-excel- 2002

感谢您的回答!这就成功了:

="UPDATE EMPLOYEES SET ID = '" & A1& “' WHERE EMPLOYEE = '” & B1& “'”

Answered correctly in superuser https://superuser.com/questions/55262/append-a-text-string-to-the-left-of-all-the-cells-of-a-column-in-excel-2002

Thanks for the answers! This did the trick:

="UPDATE EMPLOYEES SET ID = '" & A1 & "' WHERE EMPLOYEE = '" & B1 & "'"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文