Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the string functions in SQLServer

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about what string functions are in SQLServer. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

String function

Len () calculates the length of the string

Select LEN (name) from test1-calculates the length of the name

Case conversion lower () upper ()

Select lower ('STUDENT!') select upper ('student!')

Remove the space on the left side of the empty ltrim () string and the space on the right side of the rtrim () string

Declare @ str varchar ='an an a 'select ltrim (@ str) select rtrim (@ str)

String interception substring () left () right ()

Select substring ('HelloWorldcast Magazine 6, 6)-select left of any length can be intercepted (5)-select right can be intercepted from the left (HelloWorldwide recording 6)-intercepted from the right

String replacement replace ()

Select replace ('HelloWorldConcepts, replacement, etc.)-string, the string to be replaced, the string to be replaced

Strings drop the order reverse ()

Select reverse ('abc')-- cba

Returns the unpositioned charindex () where string 1 appears in string 2

Charindex (srt1, srt2)-- the start position of srt1 in srt2. The result is: 5-- only the position that appears for the first time can be checked, and no match returns 0.

The specified number of repeats string value replicate ()

The result of select replicate ('abc',4) is: abcabcabcabc, thank you for reading! This is the end of this article on "what are the string functions in SQLServer?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report