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 2005 Forums
 SSIS and Import/Export (2005)
 DT_TEXT
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Brittney10
Posting Yak Master

USA
153 Posts

Posted - 03/08/2013 :  15:32:08  Show Profile  Reply with Quote
I have a column that contains 8000+ characters, so I've defined the column as DT_Text in my flat file connection. My issue is that I'm trying to get the field into a nvarchar(4000) AND if the column is greater than 4000 characters, I need to get the rightmost 4000 characters only and cut off the rest. When I define the column as DT_STR 4000 (or even 8000) it seems to grab the 4000 (or 8000 characters) at random from the text string.

Any suggestions would be helpful.

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 03/09/2013 :  01:18:02  Show Profile  Reply with Quote
why not apply a derived column transform and use an expression like

SUBSTRING(column,1,4000)

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

Go to Top of Page

Brittney10
Posting Yak Master

USA
153 Posts

Posted - 03/11/2013 :  10:18:43  Show Profile  Reply with Quote
When I apply SUBSTRING(Column, 1,4000) in a derived column...I get the error - "The function SUBSTRING does not support the data type DT_Text for parameter number 1."
Go to Top of Page

Brittney10
Posting Yak Master

USA
153 Posts

Posted - 03/11/2013 :  11:19:58  Show Profile  Reply with Quote
The assumption is that since SUBSTRING can be used on TEXT data type columns in T-SQL then it can be used on TEXT data type columns in SSIS - this assumption is incorrect. I will have to stage the data in SQL and scrub the data there.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 03/11/2013 :  12:53:33  Show Profile  Reply with Quote
then cast it and do substring

SUBSTRING((DT_WSTR,4000)column,1,4000)

------------------------------------------------------------------------------------------------------
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.03 seconds. Powered By: Snitz Forums 2000