Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 eliminate comma from string

Author  Topic 

scottichrosaviakosmos
Yak Posting Veteran

66 Posts

Posted - 2011-05-07 : 10:04:57
I have a table in sql server which is populated from oracle table . For this import i am using ssis . now I have columns of first name and last name . In these columns the data is not going in proper manner. This is because Some data is comming with ","(comma) in beween strings. exmp: lastname='Mor,gan' .
I want to get out of this. I want my data to be inserted in proper format.
If any commas in between or in last or in start of the string then it will eliminate it and insert corrected data to sql server.


scoo

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-07 : 10:22:36
update tbl
set lastname = relace(lastname,',','')
where latname like '%,%'

or you can us ean expression in ssis.

what will you do if a string has a ginuine comma in it.
Do you know where these commas are being introduced?

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

scottichrosaviakosmos
Yak Posting Veteran

66 Posts

Posted - 2011-05-09 : 02:27:20
this is ok, but how can i achive this while transferring data from source to destination.
and this is basically by update and only for comma, but what if i have some other special character. how can i make it work with some ssis tool. I am sure there will be some SSIS tool for this.




scoo
Go to Top of Page

duncanwill
Starting Member

20 Posts

Posted - 2011-05-09 : 06:29:48
You could use a "derived column" task in the dataflow - you can set the Expression in there to remove/replace whatever you need to.

Go to Top of Page
   

- Advertisement -