16 reputation
3
bio website
location
age
visits member for 2 years, 5 months
seen Jun 18 '12 at 18:09

Apr
19
awarded  Popular Question
Sep
9
awarded  Student
Sep
9
awarded  Teacher
Jun
17
answered SQL NULL Value to = A Sequential Number, Help!
Jun
17
comment SQL NULL Value to = A Sequential Number, Help!
Solved UPDATE r SET HardwareNumber = r.NextID FROM (select 999999899 + ROW NUMBER() over (order by HardwareNumber) AS NextID,HardwareNumber FROM tblAsset WHERE HardwareNumber is NULL) r
Jun
17
comment SQL NULL Value to = A Sequential Number, Help!
Thanks for your quick reply, I have just tried the new code and executes fine but 0 rows affected, there should be at least 250 odd. Looking at the code and I only know the basic sql nothing is saying IF HardwareNumber IS NULL then .....
Jun
17
comment SQL NULL Value to = A Sequential Number, Help!
Thank you for your help. First version I tested and I found it didn't work syntax executed fine though. The ID is Asset_ID as it is in the Asset_tbl
Jun
16
comment SQL NULL Value to = A Sequential Number, Help!
Ive just tried the following code: UPDATE tblAsset SET HardwareNumber = r.NextID FROM tblAsset cross join (select 10000000 - ROW NUMBER() over (order by RAND()) AS NextID FROM tblAsset WHERE HardwareNumber is NULL) r WHERE tbl.Asset.HardwareNumber is NULL - This code only changes all NULL values in the HardwareID field to 99999999.
Jun
16
comment SQL NULL Value to = A Sequential Number, Help!
HI Marian, I believe the Nvarchar field size is 10 or 15, If I used GUIDs would mean changing the field size to 32 if I remember correctly, plus GUIDs are not always generated randomly although I'm sure your agree the chance of the system generating a duplicate ID String is near impossible. Good Idea this may have to be my second option.
Jun
16
asked SQL NULL Value to = A Sequential Number, Help!