开发者

Need help with Select Into

开发者 https://www.devze.com 2022-12-21 21:20 出处:网络
I\'m trying to create my first data mart. I am creating开发者_高级运维 my dimension table with a \"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

精彩评论

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

关注公众号