Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
netedk
Starting Member
11 Posts |
Posted - 2004-02-26 : 15:24:31
|
I have a table with a large number of records . I have decided to horizontally partition the table and I intent to use a partitioned view to select, insert, update and delete data.My old table has an IDENTITY field as the primary key. In the partitioned scheme I plan to use a composite key - id, partition_id as the primary key. The id field here is not IDENTITY and I have to auto-increment the field using programmatic logic (this is because IDENTITY fields cannot be a part of the primary key for partitioned views to work).Now, my old table has some BULK INSERT statements running on it. The BULK INSERT uses a .csv file - this file does not have a id field - the values are being generated automatically. But if I am to move away from IDENTITY field - how should I do BULK INSERT and still assign unique values into the 'id' field?This is the first time I am working with partitioned views - so am not very clear about this - any help will be greatly appreciated.Thanks a lot..... DK |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-02-26 : 15:52:06
|
| I'm making a list of why not to use IDENTITY..Thanks for another one...Do you have control over the table? How does data get in to the table.How about this...Create a stage tableLoad a staging table with the dataDo a SELECT MAX(id) From your viewUse dynamic SQL to ALTER Stage and add an IDENTITY where the seed is max+1, increment is 1Then insert into the view from stagejust a thought..not to pretty...Brett8-) |
 |
|
|
|
|
|