Sunday, August 31, 2014

Substring,Left,right

SELECT LastName,firstname, SUBSTRING(LastName, 4, 4) as Initial

FROM Person.Person

WHERE LastName like 'Barl%'

ORDER BY LastName;

select * from Person.Person

--SUBSTRING ( expression ,start , length )

Select AddressLine1,SpatialLocation,SUBSTRING(cast(SpatialLocation as varchar(50)), 4, 4) as Address

from Person.Address

select PostalCode from Person.Address

SELECT firstName,lastname,RIGHT(FirstName, 4) AS 'First Name'

FROM Person.Person

SELECT firstName,lastname,left(FirstName, 2) AS 'First Name'

FROM Person.Person

SELECT firstName,lastname,SUBSTRING(FirstName,1,2) AS 'First Name'

FROM Person.Person

No comments: