Concat in Sql Server 2012
T-SQL String function concat allows us to append/prepend text to a column. or format a column.
Example: Players Table has Salary Column, That needs to be updated with currency symbol.
declare @sal varchar(50)
update [tempo1].[dbo].[players] set @sal=[Salary (US$)], [Salary (US$)]=CONCAT(@sal,'$')
OUTPUT
RK PLAYER Salary (US$)
1 Alex Rodriguez 30,000,000$
2 CC Sabathia 24,285,714$
3 Mark Teixeira 23,125,000$
4 Ichiro Suzuki 18,000,000$
5 Derek Jeter 15,729,365$
6 Mariano Rivera 14,940,025$
7 Robinson Cano 14,000,000$
1 Alex Rodriguez 30,000,000$
2 CC Sabathia 24,285,714$
3 Mark Teixeira 23,125,000$
4 Ichiro Suzuki 18,000,000$
5 Derek Jeter 15,729,365$
6 Mariano Rivera 14,940,025$
7 Robinson Cano 14,000,000$
No comments:
Post a Comment