Osama Bin Gandhi Posted August 29, 2014 Report Posted August 29, 2014 Oka easiest solution cheppandi.. Oka column in a table ni rename cheyyali which has 500 rows. The column pattern is like: abc $ 1 bcd $ 2.5 xyz $ 33 pqr $ 100 ...so on ippudu aa string lo unna value ni +1 chesi update cheyyali.. abc $ 2 bcd $ 3.5 xyz $ 34 pqr $ 101 ...so on RIGHT (columnname,3) hint dorkindi but ela proceede avvalo ardham avvatledhu.. IF condition use cheyochu ani pistundi, kaani tarvata REPLACE etla cheyyalo ardham avvatle.. SUggestions pls.
ramu Posted August 29, 2014 Report Posted August 29, 2014 Create new column... copy data to new column with changing value to +1 using substr...update old column values to null n drop tht column
ChampakDas Posted August 29, 2014 Report Posted August 29, 2014 declare @newcolname varchar(100) set @newcolname = do your stuff exec sp_rename 'oldcolname' , @newcolname, 'COLUMN'
ramu Posted August 29, 2014 Report Posted August 29, 2014 Select substr(columnname,1,instr(columnname,'$'))||' '||(to_number(trim(substr(columnname,instr(columnname,'$')+1)))+1) as finalvalue from testtable ee vachina value tho new column populate cheyyi...old column teeseyi 1
jaffanajeffada Posted August 29, 2014 Report Posted August 29, 2014 :4_12_13: :4_12_13: Select substr(columnname,1,instr(columnname,'$'))||' '||(to_number(trim(substr(columnname,instr(columnname,'$')+1)))+1) as finalvalue from testtable ee vachina value tho new column populate cheyyi...old column teeseyi
Osama Bin Gandhi Posted August 29, 2014 Author Report Posted August 29, 2014 Thank you RockStarZ Select LEFT(COLUMN1,CHARINDEX('$',COLUMN1)) + (RIGHT(COLUMN1,LEN(COLUMN1)-CHARINDEX('$',COLUMN1))+1) FROM TABLE1 worked for me
Recommended Posts