Click here to Skip to main content
16,004,761 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to split query so that i get the data in new lines..such as

US Mail (9.50)
First Class Mail (Canada) (15.00)
Airmail (International Addresses) (26.00) etc...

here is the query which i tried using | it does'nt work..Can anyone pls give me the query


select SettingValue from ApplicationSettings where SettingValue='US Mail (9.50)|First Class Mail (Canada) (15.00)|Airmail (International Addresses) (26.00)|+Next Day Air (16.00 + 28.66 = 44.66)|UPS 2ND Day (11.00 + 17.44 = 28.44)|UPS Ground (10 + 9.29 = 19.29)|UPS NEXT DAY AIR (10.00 + 17.44 = 27.44)'
Posted

1 solution

you can create a fuction to remove this ,just

SQL
create FUNCTION [FN_REMOVE_SPECIAL_CHARACTER] (  
 @INPUT_STRING varchar(300))
RETURNS VARCHAR(300)
AS 
BEGIN
 
--declare @testString varchar(100),
DECLARE @NEWSTRING VARCHAR(100) 
-- set @teststring = '@san?poojari(darsh)'
 SET @NEWSTRING = @INPUT_STRING ; 
With SPECIAL_CHARACTER as
(
SELECT '|' as item

 )
SELECT @NEWSTRING = Replace(@NEWSTRING, ITEM, '') FROM SPECIAL_CHARACTER  
return @NEWSTRING 
END


run this Fuction on your query window

and pass your string.

SQL
select dbo.[FN_REMOVE_SPECIAL_CHARACTER] ('US Mail (9.50)|First Class Mail (Canada) (15.00)|Airmail (International Addresses) (26.00)|+Next Day Air (16.00 + 28.66 = 44.66)|UPS 2ND Day (11.00 + 17.44 = 28.44)|UPS Ground (10 + 9.29 = 19.29)|UPS NEXT DAY AIR (10.00 + 17.44 = 27.44)')
 
Share this answer
 
v3
Comments
Challa92 13-Feb-14 1:10am    
can u pls tell me how to do it
King Fisher 13-Feb-14 1:16am    
what s your expected Result?
King Fisher 13-Feb-14 1:16am    
is this?
US Mail (9.50)
First Class Mail (Canada) (15.00)
Airmail (International Addresses) (26.00) etc...
Challa92 13-Feb-14 1:16am    
US Mail (9.50)
First Class Mail (Canada) (15.00)
Airmail (International Addresses) (26.00) etc...
Challa92 13-Feb-14 1:17am    
yes the same way in ()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900