happysmile
happysmile

Reputation: 7777

update Query for large number of records

i have an table with 20000 records, now i need to update around 10000 records with new time stamp value. i have an column with name timestamp

now how can i update new timestamp values for around 10000 records at a single Query,

any Solution on this would be great

thanks

Upvotes: 0

Views: 643

Answers (2)

Adriaan Stander
Adriaan Stander

Reputation: 166396

How about

UPDATE <YourTable>
SET <TimeStampColumn> = <AppropriateValue>
WHERE <YourCriteriaColumn> = <YourCriteria>

Upvotes: 1

gbn
gbn

Reputation: 432271

You'd use a simple UPDATE statememt.

And you'd have a WHERE clause to restrict to the 10k rows you mentioned.

And you'd have a the new value of course...

I haven't defined @MyFilter here: you can do some thinking for yourself, no?

DECLARE @NewValue datetime

SET @NewValue = GETDATE()

UPDATE
   MyTable
SET
   [timestamp] = @NewValue
WHERE
   filtercolumn = @MyFilter --what condition?

Upvotes: 3

Related Questions