ttmind

Main Navigation

ttmind
  • jim-jams
  • Tech
  • Positive
Login

Login

Facebook Google

OR

Remember me Forgot password?

Don't have account? Signup here.

Sort by Categorys

.Net

PHP

Java

JavaScript

Database

Server

Client Side

Tools

Artificial Intelligence

Cloud

Hybrid Development

Event

Smart City

Education

Security

Scrum

Digital Marketing

APP Development

Business

Internet

Simulation

Art

Network

Microservices

Architecture

Technology

Leadership

    Top Articles

  • How Does Social Media Bring People Together?
    TTMind Author
  • How to read appSettings JSON from Class Library in ASP.NET Core
    Anil Shrestha
  • Printing Support In Asp.Net Core
    TTMind Author
  • HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?
    Prakash Pokhrel
  • Images Upload REST API using ASP.NET Core
    Prakash Pokhrel
  • Related Topic

  • Hosting ASP.NET Core Web API on IIS
  • Use of TOP and DISTINCT in SQL SERVER
  • Difference between char, nchar, varchar, and nvarchar in MS SQL Server
  • What's new in SQL Server 2019?
  • Uploading .csv sample table file data to SQL Server
  • Tech
  • About Us
  • Contact Us
  • TechHelp
  • PositiveHelp
  • Jim-Jams Help
  • Terms & Conditions

© Copyright ttmind.com

Main Content

TRIM Function in SQL Server 2017

Server SQL Server about 7 years ago || 9/13/2018 || 2.6 K View

  • Hide

we can see that most of the languages have the trim function. But, Today I am going to write about Trim Function in SQL Server 2017.  Trim Function helps to remove White spaces or other specified characters from the start as well as the end of the String.
Syntax:

TRIM ( [ characters FROM ] string ) 

Where Characters represents variable, literals or function call of any non-LOB character types (nvarchar, varchar, nchar, or char). But Data type like. varchar(max) and nvarchar(max) are not allowed.
For Example:
1. Space Character Remove from both side of String

SELECT TRIM( '      TTMIND     ') AS Output;

Output:

TTMIND

2.  Removing specified character from the string 
 

SELECT TRIM( '.,! ' FROM  '#     TTMIND !   .') AS Output;

Output:

#      TTMIND

 

  • 1
  • 0
  • 0
    • Facebook
    • Twitter
    • Google +
    • LinkedIn

About author

Prakash Pokhrel

Prakash Pokhrel

https://np.linkedin.com/in/prakash-pokhrel-42a699a2

Reset Your Password
Enter your email address that you used to register. We'll send you an email with your username and a link to reset your password.

Quick Survey