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 2008 Forums
 SSIS and Import/Export (2008)
 convert to string in complex derived column

Author  Topic 

dplaut
Starting Member

7 Posts

Posted - 2013-03-19 : 14:10:45
I have this statement in a derived column:

FINDSTRING([Col1],"(",1) > 0 ? (DT_STR,3,1252)SUBSTRING([Col1],(FINDSTRING([Col1],"(",1) + 1),FINDSTRING([Col1],")",1) - FINDSTRING([Col1],"(",1) - 1) : (DT_STR,3,1252)NULL(DT_STR,3,1252)

I'm trying to get this to come out as a string instead of unicode string but it always comes out as unicode no matter where I put "(DT_STR,3,1252)."

Hints greatly appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-20 : 11:03:36
try this too
(DT_STR,3,1252)(FINDSTRING([Col1],"(",1) > 0 ? (DT_STR,3,1252)SUBSTRING([Col1],(FINDSTRING([Col1],"(",1) + 1),FINDSTRING([Col1],")",1) - FINDSTRING([Col1],"(",1) - 1) : (DT_STR,3,1252)NULL(DT_STR,3,1252))


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dplaut
Starting Member

7 Posts

Posted - 2013-03-20 : 11:58:21
I tried that. As soon as you put it in Studio flags that as red incompatible for binary operator ">"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-20 : 13:05:32
whats the datatype of Col1?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dplaut
Starting Member

7 Posts

Posted - 2013-03-22 : 07:55:31
Col1 is a string.

Trying to do this:

col1 example content: blah blah blah (hello)

If there is a parentheses then created a derived col w/ the ext inside of the parens. I got this to work but was not able to force it to be a string. Always comes out as unicode string.

quote:
Originally posted by visakh16

whats the datatype of Col1?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-22 : 13:33:16
you need to first make the conversion and then do other manipulations in it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -