Logo

SQL Server STRIP Function

Updated 2023-11-10 16:19:03.207000

Description

Use the scalar function STRIP to remove punctuation from the beginning and end of a string.

Syntax

SELECT [westclintech].[wct].[STRIP] (
   <@Text, nvarchar(max),>)

Arguments

@Text

is the text to be stripped. The @Text argument can be of data types that are implicitly convertible to nvarchar or ntext.

Return Type

nvarchar(max)

Remarks

STRIP removes punctuation remarks regardless of where they appear in the string.

Punctuation marks are:

DESCRIPTIONCODESYMBOL
EXCLAMATION MARK33!
QUOTATION MARK34"
NUMBER SIGN35#
DOLLAR SIGN36$
PERCENT SIGN37%
AMPERSAND38&
APOSTROPHE39'
LEFT PARENTHESIS40(
RIGHT PARENTHESIS41)
ASTERISK42*
PLUS SIGN43+
COMMA44,
HYPHEN-MINUS45-
FULL STOP46.
SOLIDUS47/
COLON58:
SEMICOLON59;
LESS-THAN SIGN60<
EQUALS SIGN61=
GREATER-THAN SIGN62>
QUESTION MARK63?
COMMERCIAL AT64@
LEFT SQUARE BRACKET91[
REVERSE SOLIDUS92\
RIGHT SQUARE BRACKET93]
CIRCUMFLEX ACCENT94^
LOW LINE95_
GRAVE ACCENT96`
LEFT CURLY BRACKET123{
VERTICAL LINE124|
RIGHT CURLY BRACKET125}
TILDE126~
EURO SIGN128
SINGLE LOW-9 QUOTATION MARK130
LATIN SMALL LETTER F WITH HOOK131ƒ
DOUBLE LOW-9 QUOTATION MARK132
HORIZONTAL ELLIPSIS133
DAGGER134
DOUBLE DAGGER135
MODIFIER LETTER CIRCUMFLEX ACCENT136ˆ
PER MILLE SIGN137
LATIN CAPITAL LETTER S WITH CARON138Š
SINGLE LEFT-POINTING ANGLE QUOTATION MARK139
LATIN CAPITAL LIGATURE OE140Œ
LEFT SINGLE QUOTATION MARK145
RIGHT SINGLE QUOTATION MARK146'
LEFT DOUBLE QUOTATION MARK147
RIGHT DOUBLE QUOTATION MARK148
BULLET149
EN DASH150
EM DASH151
SMALL TILDE152˜
TRADE MARK SIGN153
SINGLE RIGHT-POINTING ANGLE QUOTATION MARK155
INVERTED EXCLAMATION MARK161¡
CENT SIGN162¢
POUND SIGN163£
CURRENCY SIGN164¤
YEN SIGN165¥
BROKEN BAR166¦
SECTION SIGN167§
DIAERESIS168¨
COPYRIGHT SIGN169©
FEMININE ORDINAL INDICATOR170ª
LEFT-POINTING DOUBLE ANGLE QUOTATION MARK171«
NOT SIGN172¬
SOFT HYPHEN173­
REGISTERED SIGN174®
MACRON175¯
DEGREE SIGN176°
PLUS-MINUS SIGN177±
ACUTE ACCENT180´
PILCROW SIGN182
MIDDLE DOT183·
CEDILLA184¸
MASCULINE ORDINAL INDICATOR186º
RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK187»
INVERTED QUESTION MARK191¿
MULTIPLICATION SIGN215×
DIVISION SIGN247÷

Examples

Select wct.STRIP('$1,000');

This produces the following result.

column 1
1,000