on 2023 Dec 15 1:38 PM
Hello,
HOW I CAN ELIMINATE THE SYMBOLS AND KEEP ONLY THE NUMBERS AND LETTERS IN THE RESULT OF MY QUERY SQL?
FOR EXAMPLE example :
From : ML TUBE INOX 316L Ø 27X3MM""
To : ML TUBE INOX 316L 27X3MM
Any ideas?
Regards.
Request clarification before answering.
Hi,
In your case, follow these steps:
1. Create function
Create FUNCTION dbo.UF_Remove_SpecialCharacters( @str VARCHAR(MAX))
RETURNS VARCHAR(MAX) AS
BEGIN
DECLARE @expres VARCHAR(50) = '%[~,@,#,$,%,&,*,(,),.,Ø,",!]%'
WHILE PATINDEX( @expres, @str ) > 0
SET @str = Replace(REPLACE( @str, SUBSTRING( @str, PATINDEX( @expres, @str ), 1 ),''),'-',' ')
RETURN @str
END
2. Then query with the function

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 53 | |
| 29 | |
| 21 | |
| 10 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.