Wednesday, March 7, 2012

Bulk Insert + auto incremented PK

Is there a way to have a PK column auto generated while doing a bulk insert?
Thanks ya'll!!!
T.B.Yes, look at Identity column.
e.g.
CREATE TABLE Sales
(
SaleID INT IDENTITY(1,1) ,
SalesRegion CHAR(2)
)
Through Enterprise Manager, you also can change a column to be an identity
column when you modify the table structure.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"The Bear" <buck_roggers@.hotmail.com> wrote in message
news:odqdnbLVL_v5M_vfRVn-pg@.rogers.com...
> Is there a way to have a PK column auto generated while doing a bulk
> insert?
> Thanks ya'll!!!
> T.B.
>|||You need to use a format file. See book online for detail on how to create
one.
-oj
"The Bear" <buck_roggers@.hotmail.com> wrote in message
news:odqdnbLVL_v5M_vfRVn-pg@.rogers.com...
> Is there a way to have a PK column auto generated while doing a bulk
> insert?
> Thanks ya'll!!!
> T.B.
>

No comments:

Post a Comment