如何从数据库中的现有表将数据填充到临时表中 [英] How To fill Data into temporary table from existing table in database

查看:265
本文介绍了如何从数据库中的现有表将数据填充到临时表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我已经创建了一个临时表,其字段与数据库中现有表的字段相同.但是在将现有表的数据引入临时表时遇到了问题.如何从现有表中填充临时表.

Hello All,
I have created a temporary table with same fields as that in existing table in database.But i am getting problem in bringing the data of existing table into temporary table.How It is possible to fill the temporary table from existing table .

推荐答案

使用SQL Server Management Studio中的导入数据选项.
Use Import Data option from SQL Server Management studio.


只需创建表,然后将其插入表中即可.

创建表
It''s just a matter of creating the table, then inserting into it

Create Table
CREATE TABLE #CampAlloc (
    [TitleID] [int] NOT NULL ,
    [SupplierID] [int] NOT NULL ,
    [RecordingCompanyID] [int] NULL
) ON [PRIMARY]



插入数据



Insert Data

INSERT INTO #CampAlloc
SELECT TitleID, SupplierID, RecordingCompanyID
FROM CampaignAllocation
WHERE CampaignID = @CampaignID 



您遇到什么问题,出现任何错误消息?



what problem are you getting, any error message?


这篇关于如何从数据库中的现有表将数据填充到临时表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆