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 2012 Forums
 Transact-SQL (2012)
 insert

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-05-16 : 10:04:24
hi
i have this code that select the text i want i want to add this to a coulmn in my table

select
case
when charindex('Class',[Group]) > 0
then substring([Group], charindex('Class',[Group])+0,len([Group])-charindex('Class',[Group])+1)

end
from dbo.BNYWorkingTempNavTable

whats the best way to do it

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-16 : 12:02:16
update SomeTable
set SomeColumn =
case
when charindex('Class',[Group]) > 0
then substring([Group], charindex('Class',[Group])+0,len([Group])-charindex('Class',[Group])+1)
end


Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -