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 |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2013-02-07 : 08:08:02
|
I need to insert into a field for testing, but the field has a contraint on an ID from abother field. I want to do un update with a random number between 2 defined numbers like 21 and 61??DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2013-02-07 : 08:38:58
|
Got itDeclare @maxRandomValue tinyint = 15 , @minRandomValue tinyint = 29;UPDATE tblTrkRecordSET SubStatusId = (SELECT CAST((@maxRandomValue + 1 - @minRandomValue) * RAND() + @minRandomValue AS tinyint) AS Expr1)WHERE (StatusId = 7)DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|