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.
Author |
Topic |
kathyc2003
Starting Member
15 Posts |
Posted - 2006-11-02 : 11:19:32
|
I need to write an update statement that replaces AccountNumber's thatcontain "* *" with "*". Below is the select statement that displays the rows, but I can't figure out how to wrap the update statement around it.SELECT Name, SUBSTRING(AccountNumber, 1, LEN(AccountNumber))FROM dbo.AccountBaseWHERE AccountNumber IS NOT NULLAND AccountNumber LIKE '%* *%'ORDER BY Name ASC;Thank you. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-02 : 11:29:46
|
[code]update aset AccountNumber = replace(AccountNumber, '* *', '*')from dbo.AccountBase aWHERE AccountNumber IS NOT NULLAND AccountNumber LIKE '%* *%'[/code] KH |
 |
|
Kristen
Test
22859 Posts |
Posted - 2006-11-02 : 12:06:39
|
"AccountNumber IS NOT NULL AND"Bit redundant, Old Boy!Kristen |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-02 : 20:21:02
|
>>SUBSTRING(AccountNumber, 1, LEN(AccountNumber))Isnt this equal to AccountNumber?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|