December 1, 2006 at 5:40 am
Hi there, I have a column that hold about 7000 rows of data, what I need to so is run some tsql that will update all the rows of this column to '20202' ie every row in that column should have a value of 20202.
how would this be done?
Many thanks
December 1, 2006 at 6:18 am
an update statement, without a WHERE statement, would affect every row for the field affected;
ie:
UPDATE YOURTABLE SET MYCOLUMN='20202'
UPDATE YOURTABLE SET MYCOLUMN='20202' WHERE STATE='NY'
typically, you never want to do this(update without a WHERE statement...(what if this was a mission critical accounting table? do you have backups you can roll back to?), but sometimes it has to be done;as you want to update based on some criteria; also, you should always do a select statement with the same criteria to see what you are really going to affect.
Lowell
December 1, 2006 at 6:31 am
Thanks for that, I knew there was a simple way to do it, somebody gave me a cursur script to use and I knew there had to be a simpler way...thanks again
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply