Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

sql - 将数据插入临时表(Inserting data into a temporary table)

After having created a temporary table and declaring the data types like so;

(创建临时表并声明数据类型之后;)

 CREATE TABLE #TempTable(
 ID int,
 Date datetime,
 Name char(20))

How do I then insert the relevant data which is already held on a physical table within the database?

(然后,如何插入已保存在数据库中物理表上的相关数据?)

  ask by William translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
INSERT INTO #TempTable (ID, Date, Name) 
SELECT id, date, name 
FROM physical_table

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...