How to get the first character of a string in SQL Server ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

Assume a scenario where you have a column in your table in SQL Server database where you want to retreive the first character of the column value.

How to get the first character of a string in SQL Server ?

You can use the LEFT function and specify the column name as well as the number of characters from left that you want to retreive.


Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book BUY & DOWNLOAD GRAPHQL.NET COOKBOOK
Use AdventureWorks2014
GO    
SELECT LEFT(Name,1) as FirstCharacter from HumanResources.Department
image
%d bloggers like this: