T-SQL String Data Types and Function

 Substring











NULL




























































































Another way to do the same thing.























declare @firstname as nvarchar(20)
declare @middlename as nvarchar(20)
declare @lastname as nvarchar(20)

set @firstname = 'Wakka'
set @middlename = 'Cassa'
set @lastname = 'Booba'

--select 

select @firstname + CASE WHEN @middlename IS NULL THEN '' ELSE ' ' + @middlename END + ' ' + @lastname as FullName























CONCAT 






















41 : Joining a String to a number: 

The number 3456 is converted to varchar below.

select 'This is the name of the unit: ' + convert(varchar(20), 3456)


select 'This is the name of the unit: ' + convert(varchar(20), 3456) as UnitCol
select 'This is the name of the unit: ' + cast(4567 as varchar(20)) as Cast_Col



















Converting to Pound sterling 











France Currency :















DATA DATA TYPES


















































48 : Today's Date and More date function : 



































































































































Converting date back to strings 













































Comments

Popular posts from this blog

Session : 2 : Creating and querying part of a table