本文介绍了如何从现有表创建新表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
dbo.Profile_Updated
(
BusinessName VARCHAR,
ContactName VARCHAR,
Address VARCHAR,
City VARCHAR,
State VARCHAR,
Postalcode INT PRIMARY KEY,
Phonenumber VARCHAR
)
这是我当前的表,但现在我想从现有的 Profile_Updated
表列创建新表,我的意思是新表 (PostalDB
) 需要包含这些列City, State, Postalcode
基于 Profile_Updated
表.
This is my current table but now I want to create new table from the existing Profile_Updated
table column, I mean the new table (PostalDB
) needs to contain the columns City, State, Postalcode
based on Profile_Updated
table.
有人可以帮我吗?
提前致谢.
推荐答案
我假设你只是说SELECT INTO
:
SELECT City, State, Postalcode
INTO dbo.PostalDB
FROM dbo.Profile_Updated;
CREATE UNIQUE CLUSTERED INDEX p ON dbo.PostalDB(PostalCode);
CREATE INDEX ... -- you'll need to fill in these details
这篇关于如何从现有表创建新表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!