将两列中的值转换为临时表 [英] Getting values from two columns into a temporary table

查看:132
本文介绍了将两列中的值转换为临时表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两列COLUMN1 ADN COLUMN2。我想将column1和two中的值存储到临时表中。如何实现这个目标?



column1的值为1,2,3,4,5,第2列的值为6,7,8,9,10


i需要一个包含所有值的临时表。



ie

1

2

3

4

5

6

7

8

9

10

i HAVE GOT TWO COLUMNS COLUMN1 ADN COLUMN2. I want to store the values from column1 and two into a temporary table. How to acheive this?

column1 has values 1,2,3,4,5 and column 2 has values 6,7,8,9,10

i want a temporary table which contains all the values.

i.e
1
2
3
4
5
6
7
8
9
10

推荐答案

谢谢大家你的答案


你走了!!!关于临时表的所有内容 快速概述:SQL Server 2005中的临时表 [ ^ ] [ ]



Here you go!!! everything about Temporary Table Quick Overview: Temporary Tables in SQL Server 2005[^][]

Declare @TempTableVariable TABLE(
UserID int,
UserName varchar(50), 
UserAddress varchar(150)) 

insert into @TempTableVariable values ( 1, 'Abhijit','India');






选择*进入temp_table(se lect column1 from table_name union all select column2 from table_name)
Hi,

Select * into temp_table (select column1 from table_name union all select column2 from table_name)


这篇关于将两列中的值转换为临时表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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