SQL Server 2005数据保留 [英] SQL Server 2005 Data Hold

查看:90
本文介绍了SQL Server 2005数据保留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我正在使用SQL server2005.在我的数据库中,我有两个表,分别是table1和table2. table1有10列,而table2有15列,我想创建一个存储过程,在其中我想将table1的所有10列数据复制到table2,而table2的其余5列将获得其他一些外部数据,如date.etc.

我不知道如何复制和保存table1数据,然后将其与其他5列数据一起添加到table2.

有人可以指导我吗?

提前谢谢.
:-)

Hello friends,

I am using SQL server2005. In my database i have two tables say table1 and table2. table1 have 10 columns and table2 have 15columns here i want to create a stored procedure in which i want to copy all 10columns data of table1 to table2 and remaining 5 columns of table2 would get some other external data such as date.etc.

I don''t know how to copy and hold table1 data and then add to table2 with other 5 columns data.

Can anybody guide me for same.

Thanks in advance.
:-)

推荐答案

基于select 所以:
Do a Insert Into based on a select
so:
Insert Into table2
 (col1, col2, col3...col10)
SELECT col1, col2, col3...col10
FROM table1


这篇关于SQL Server 2005数据保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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