SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 convert to string in complex derived column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dplaut
Starting Member

7 Posts

Posted - 03/19/2013 :  14:10:45  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 03/20/2013 :  11:03:36  Show Profile  Reply with Quote
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 - 03/20/2013 :  11:58:21  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 03/20/2013 :  13:05:32  Show Profile  Reply with Quote
whats the datatype of Col1?

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

Go to Top of Page

dplaut
Starting Member

7 Posts

Posted - 03/22/2013 :  07:55:31  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 03/22/2013 :  13:33:16  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000