开发者

Need help with Select Into

I'm trying to create my first data mart. I am creating开发者_高级运维 my dimension table with a "Select Into"

The code is as follows:

select distinct fpc_number, fpc_desc 
into m2mdata01dw..ProdClass
from m2mdata01..INPROD

How can I set up a autonumber primary key in this situation?


select *, identity (int)  as myid  
into #temp
from mytable

This is the better solution than alter table I think, create the identity at the time you do the selct into.


You can add an identity after the select into completes.

Alter Table ProdClass add Id int Identity Primary Key
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜