如何轻松连接 Microsoft SQL Server 表?
我有两个单独的表用于类别。
一个是Categories(ID, Title, Description)
,另一个是SubCategories(ID, UpperID, Title, Description)
我想将类别中的记录插入到子类别中上ID=0。我看过 SQL SELECT INTO
但不知道如何将它用于现有表。
I have two separate tables used for categories.
One is Categories(ID, Title, Description)
, and the other is SubCategories(ID, UpperID, Title, Description)
I want to insert the records from categories to SubCategories with upperID=0. I've looked at SQL SELECT INTO
but don't know how to use it for existing tables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设两个表中的 ID 列都是 Identity 列,并且 Category 中的 ID 不应传输到 SubCategories 表
This assumes that the ID column in both tables is an Identity column and that the ID in Categories should not be transferred to the SubCategories table
假设 Id 不是 Identity 字段。
assuming that Id is not Identity field.