Search code examples
sql-servernvarchar

SQL Server: Select X amount of character from value


I have a database with a nvarchar(50) column. All rows have >25 chars always in this column.

I would like to return only the first 10 characters from column WITHOUT getting all the data from SQL and getting the 10. Is it possible to ask SQL to return on the 1st 10 from a specific column?


Solution

  • Are you looking for LEFT? SELECT LEFT(col_name,10) FROM your_table