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 |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2008-02-04 : 06:43:54
|
| Is there a way I could apply my update:DECLARE @myDateField varchar(20)SET @myDateField = 'Amended_By_Date'UPDATE myTableSET @myDateField = case when @myDateField = '0' then null when LEFT(@myDateField, 2) = '10' then '200' + SUBSTRING(@myDateField,3,LEN(@myDateField)) ENDto all columns in myTable which contain the string 'date' or 'Date' as the column name? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-04 : 06:45:35
|
| You need to use dynamic sql for this |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-04 : 06:53:58
|
http://www.sommarskog.se/dynamic_sql.html E 12°55'05.25"N 56°04'39.16" |
 |
|
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2008-02-04 : 07:07:24
|
| Thanks for the link. Most informative. |
 |
|
|
|
|
|