Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Sql intercepts data before characters.
Sql intercepts data before characters.
You can use the SUBSTRING function to intercept data before characters.

In SQL, you can use the following syntax: SELECTSUBSTRING(column_name, 1, CHARINDEX ("a character ",column _ name)-1) asresultfromtable _ name is the name of the column to be intercepted, table _ name is the name of the table, and a character is the specific character to be searched. The query will return all data before the character is found. Using SUBSTRING function, we can specify the starting position and length of interception. By combining the CHARINDEX function to determine the position of the character to be intercepted, the data before a certain character can be intercepted.