Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

entire table replace "" Expand / Collapse
Author
Message
Posted Thursday, September 25, 2008 8:39 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, October 10, 2008 5:34 PM
Points: 54, Visits: 221
The below query is replacing " from column Col001 from StageTable
I want to do it for entire table or u can say From column Col001 to column Col070

Is there any method to repeat this on all columns ?


while @@rowcount > 0
update StageTable
set Col001 = replace(Col001, substring(Col001, patindex('%["]%', Col001), 1), '')
where patindex('%["]%', Col001) <> 0
Post #576057
Posted Thursday, September 25, 2008 11:05 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, November 10, 2014 7:28 AM
Points: 774, Visits: 1,200
Do you mean REPLACE all single quote with nothing (i.e. REMOVE all single quote)?

Quick and dumb way is to copy the line 70 times
Maybe generate UPDATE script via SSMS to save typing some column names

More work is probably look for sys columns and auto generate UPDATE script dynamically


SQLServerNewbie

MCITP: Database Administrator SQL Server 2005
Post #576242
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse