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 |
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2012-01-08 : 16:42:43
|
| DimCompanyCREATE TABLE [PUOds].[dimCompanyCode]( [SID] [int] NOT NULL, [CompanyCode] [nvarchar](12) NOT NULL) INSERT INTO [dimCompany] ( SID , CompanyCode, CompanyName) SELECT DISTINCT (select MAX( SID) from dimcompany ) + 1 as sid ,LTRIM(RTRIM(CompanyCodeOriginal)) as CompanyCodeFROM FF_Company)On every insert, i need the max of sid to be inserted each timeie : if i have 1 company12 company2i shoule be able to insert 3 company34 company4the sno should be instered using insert command as the sid coulmn is not identity, kindly helpTHANKSSHANMUGARAJnshanmugaraj@gmail.com |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-01-08 : 16:57:01
|
| Can you make that column identity? It's possible to roll your own identity column, but it generally either causes performance problems or correctness issues.--Gail ShawSQL Server MVP |
 |
|
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2012-01-08 : 17:00:27
|
| I dont have rights to change the existing table structure. so i have to work on the same. kindly help meTHANKSSHANMUGARAJnshanmugaraj@gmail.com |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-01-08 : 17:29:56
|
| If you cripple insert performance into this table, is that acceptable? If not, can you create another table?p.s. Not having rights doesn't mean it can't be done, someone has to have the rights. Whether or not it can be changed is not a factor of your individual permissions, it's a architectural decision. So, can this be changed to identity? Or will doing so break lots of other code?--Gail ShawSQL Server MVP |
 |
|
|
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2012-01-08 : 17:30:59
|
| ok thanks, i will dicuss the same with my leads for making it identity.THANKSSHANMUGARAJnshanmugaraj@gmail.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|
|