--string manipulation function select select select select select select select select select select select select select select select select select select select
left('srinivasan',3) as test right('srinivasan',5) as test ltrim(' srinivasan ') rtrim(' srinivasan ') substring('srinivasan',6,5) reverse('srini') charindex('@','
[email protected]') patindex('%@%','
[email protected]') replace('srinivasan','vas','sri') len('srinivasan') upper('srini') lower('srini') replicate('srini',5) space(5)+'srini' + space(5) + 'vasan' ascii('a') 'myoutput' + char(13) + 'anotheroutput' str(1.2546, 6, 3) soundex('srinivasan') difference('sri','sri')
declare @var int select @var=12345 select cast(@var as varchar(20)) declare @var int select @var=12345 select convert(varchar(20),@var) create table #temp (id_column int null) declare @column_name varchar(50), @sql_string varchar(200) select @column_name = quotename('invalid column name') select @sql_string = 'alter table #temp add ' + @column_name + 'varchar(50)' exec (@sql_string) select * from #temp