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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 using Set based operations vs Cursor

Author  Topic 

Trudye
Posting Yak Master

169 Posts

Posted - 2009-09-26 : 11:54:31
I have to pad a field that falls short of 20 bytes. I will need to select all the records that meet the above criteria to perform this task. I do not want to use a cursor, I understand that this can be done with Set based operations.

Once I select the records how do I update all of the records on the table?

Thanx,
Freddye

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-09-26 : 13:51:52
UPDATE Table1
SET Col1 = LEFT(Col1 + REPLICATE(' ', 20), 20)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -