Update all data in a table without affecting ID(PK)

update

I'm using SQL Server 2005.

I have a table with 4846 customer records. The PK is called ID and spans from record 40003 to 79870.
This numbers are used a other tables to hold info about user orders, for example.
Within the table there's a decimal field that stores the amount of credit each user is entitled (CustomerCredit).

Now, the problem is I cant manage to come a up to a way of updating all of the CustomerCredit records without affecting the ID field… The only information that needs to change is the credit amount per each user.

Any clue will be more than appreciated.

Best Answer

I am not fully clear regarding where you get the new CustomerCredit value but an SQL update should never change ID unless you explicitly tell it to.

UPDATE [table] SET CustomerCredit = 100.0 WHERE ID = [customer-id-to-update]

or setting all records to the same value, just omit the WHERE

UPDATE [table] SET CustomerCredit = 100.0