ahmed elbarbary

ahmed elbarbary

  • 952
  • 1.5k
  • 118.1k

How to replace sub string by stuff ?

Aug 23 2020 9:44 PM
I work on sql server 2012 I need to replace substring by stuff separated stick | 
  1. SELECT DISTINCT  
  2.   [InputID],PART_ID,[Vendor ID],Manufacturer,[Digi-Key Part No.] ,[Mfr Part No.],[Description],Category,Family ,Obsolete ,[Non-Stock]   
  3.   , [Part_Status],partNumber,CompanyName,DKFeatureName2,[Variant Number],IsUnit,  
  4.   SUBSTRING((  
  5.   
  6.      SELECT  isnull(StarFormat,'') + Value+ isnull(endFormat,'')  
  7.     FROM #FinalTable   
  8.     WHERE ([InputID] = Results.[InputID] and DkFeatureId = Results.DkFeatureId)   
  9.     --FOR XML PATH(''),TYPE).value('(./text())[1]','VARCHAR(MAX)')  
  10.     FOR XML PATH(''),TYPE).value('.''NVARCHAR(MAX)')  
  11.   
  12.   ,1,5000) AS Value--,Results.accepted_value_value  
  13. FROM #FinalTable Results  
  14. where StatusId=3  
and what is meaning of using type.value for xml path 

Answers (2)