cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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.

0 Likes
View Entire Topic
mari_outtaleb96
Participant
0 Likes

Hi clas.hortien,

My version SQL Server is 2012.

sontran, I executed the query but it displays this error message.

Regards.

DeCLARE @str VARCHAR(400)= (select Itemcode from OITM)
DeCLARE @expres VARCHAR(50) = '%[~,@,#,$,%,&,*,(,),.,Ø,",!]%'

WHILE PATINDEX( @expres, @str ) > 0
SET @str = Replace(REPLACE( @str, SUBSTRING( @str, PATINDEX( @expres, @str ), 1),''),'-', ' ')
SELECT @str, 

 A.ITEMCODE, A.ItemName
,A.[DfltWH] , A.OnHand 'QTY', 
case when B.UomCode='Unité' THEN 'U'  when B.UomCode='PQt' then 'P'
 WHEN B.UomCode='Kilowatt' then 'KW' WHEN a.UgpEntry='10' then 'L'
 when A.UgpEntry='13' THEN 'KW' WHEN A.UgpEntry='11' THEN 'M²'
  ELSE B.UomCode
 END AS 'Unite de MSR', 
 A.LstEvlPric 
FROM OITM A
LEFT JOIN OUOM B ON A.[UgpEntry] = B.[UomEntry]

WHERE A.ItemCode LIKE 'MT%' AND  A.frozenFor ='N' AND ONHAND>0
Error message :
Msg 512, Level 16, State 1, Line 1Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=, >, >= or when the subquery is used as an expression.(809 row(s) affected)