Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

String Length on SSIS is fixed at 1 character!

$
0
0

I need to export data from my MS SQL server to a CSV file.  So I went through the normal steps as I've done many times before.  However, this time, I noticed that several of my fields only display the first character.  I looked at it more closely & these are the static fields which are as simple as the one below!

,'Default Category' AS '_root_category'

I figured that it must be the configuration of the flat file when it was created, so I deleted all of the contents within the file.  I went to SSIS, deleted & recreated the flat file connection manager & made sure that every column had Unicode string [DT_WSTR], with a length of 4000. I ran it again & AGAIN, it only displays the first character!

It really is a very basic query & the most complicated part is a REPLACE() function, but the results of that function come out exactly as expected! :(  Does anyone know what I should do next?

If it's of any value, this is the full SQL Query


SELECT	 
	[SC].[dbo].[bvc_Product].[ID] AS 'sku'
	,'Default' AS '_attribute_set'
	,'simple' AS '_type'
	,'Default Category' AS '_root_category'
	,'base' AS '_product_websites'
	,[SC].[dbo].[bvc_Product].[WholeSalePrice]				AS 'cost'
	,CASE
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription]) < 10 
		AND DATALENGTH([SC].[dbo].[bvc_Product].[LongDescription]) < 10)
			THEN REPLACE([SC].[dbo].[bvc_Product].[ProductName], '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])<=100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[LONGDESCRIPTION])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])>100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[ShortDescription])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		END													AS 'description'
	,'1' AS 'enable_googlecheckout'
	,'0' AS 'has_options'
	,'' AS 'image'
	,CASE
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription]) < 10 
		AND DATALENGTH([SC].[dbo].[bvc_Product].[LongDescription]) < 10)
			THEN REPLACE([SC].[dbo].[bvc_Product].[ProductName], '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])<=100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[LONGDESCRIPTION])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])>100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[ShortDescription])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		END													AS 'meta_description'
	,'' AS 'meta_keyword'
	,[SC].[dbo].[bvc_Product].[ProductName]					AS 'meta_title'
	,'Use config' AS 'msrp_display_actual_price_type'
	,'Use config' AS 'msrp_enabled'
	,[SC].[dbo].[bvc_Product].[ProductName]					AS 'name'
	,'Block after Info Column' AS 'options_container'
	,'' AS 'price'
	,'0' AS 'required_options'
	,CASE
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription]) < 10 
		AND DATALENGTH([SC].[dbo].[bvc_Product].[LongDescription]) < 10)
			THEN REPLACE([SC].[dbo].[bvc_Product].[ProductName], '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])<=100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[LONGDESCRIPTION])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		WHEN (DATALENGTH([SC].[dbo].[bvc_Product].[ShortDescription])>100)
			THEN REPLACE(
					REPLACE(	(CONVERT(NVARCHAR(MAX),[SC].[dbo].[bvc_Product].[ShortDescription])), CHAR(13)+CHAR(10), '')
				, '"', '""')
		END													AS 'short_description'
	,'' AS 'small_image'
	,'1' AS 'status'
	,'2' AS 'tax_class_id'
	,'' AS 'thumbnail'
	,'4' AS 'visibility'
--	,SC.dbo.bvc_Product.Weight
	,STR((([sc].[dbo].[bvc_Product].[weight]*0.45359237)*1000), 6, 0)	AS 'weight'
	,[SC].[dbo].[bvc_Product].[InventoryAvailableQty]		AS 'qty'
	,'0' AS		'min_qty'
	,'1' AS		 'use_config_min_qty'
	,'0' AS		 'is_qty_decimal'
	,'0' AS		 'backorders'
	,'1' AS		 'use_config_backorders'
	,'1' AS		 'min_sale_qty'
	,'1' AS		 'use_config_min_sale_qty'
	,'0' AS		 'max_sale_qty'
	,'1' AS		 'use_config_max_sale_qty'
	,'1' AS		 'use_config_notify_stock_qty'
	,'0' AS		 'manage_stock'
	,'1' AS		 'use_config_manage_stock'
	,'0' AS		'stock_status_changed_auto'
	,'1' AS		'use_config_qty_increments'
	,'0' AS		'qty_increments'
	,'1' AS		'use_config_enable_qty_inc'
	,'0' AS		'enable_qty_increments'
	,'0' AS		'is_decimal_divided'
	,[SC].[dbo].[bvc_Product_Properties_Amazon].[UPC]		AS 'upc'
FROM [SC].[dbo].[bvc_Product]
	LEFT OUTER JOIN [SC].[dbo].[bvc_Manufacturer]
	ON [SC].[dbo].[bvc_Product].[ManufacturerID] = [SC].[dbo].[bvc_Manufacturer].[ID]
	LEFT OUTER JOIN [SC].[dbo].[bvc_Product_Properties_Amazon]
	ON [SC].[dbo].[bvc_Product].[ID] = [SC].[dbo].[bvc_Product_Properties_Amazon].[ProductID]
WHERE [SC].[dbo].[bvc_Product].CompanyID='140' 
	AND InventoryAvailableQty > 0


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>