|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Inserting Nonduplicate data
How would can i insert a range of numbers without inserting duplicate value for a certain field? Here is what i have to insert the range.
declare @id int, @id2 varchar(10) set @id = 1234 while @i < 4321 begin set @id2 = 'ID_' + cast(@i as varchar(9)) INSERT INTO tblxxxx (Axxx, Bxxxx, Cxxxxxx) Values (@id2,1,31,40) set @i = @i + 1 end |
|
#2
|
|||
|
|||
|
you can always build index on that field and put the Create unique constraint. This way when you'll insert you'll get a error message
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Inserting Nonduplicate data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|