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.
Author |
Topic |
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 08:41:49
|
Hi, when i try and export a excel file, i just the following queryCREATE TABLE `Destination - Local_Catalogs` ( `ACTION` VARCHAR(12), `PROGRAM_ID ` VARCHAR(10), `SUPPLIER_ID` VARCHAR(10), `STORE_NAME ` VARCHAR(50), `ITEM_ID` VARCHAR(255), `NAME ` NVARCHAR(255), `DESCRIPTION` NTEXT, `CATEGORY_NAME` NVARCHAR(255), `SMALL_IMAGE_URL` VARCHAR(255), `MEDIUM_IMAGE_URL` VARCHAR(255), `LARGE_IMAGE_URL` VARCHAR(255), `IS_ACTIVE ` VARCHAR(5), `DISCONTINUE_DATE ` DATETIME, `INVENTORY_COUNT` INTEGER, `XML_OPTIONS` VARCHAR(50), `XML_ATTRIBUTES` VARCHAR(50), `IS_PARENT_PRODUCT` VARCHAR(5), `PARENT_PRODUCT_ID` VARCHAR(20), `VAR_MARGIN` INTEGER, `BRAND` VARCHAR(50), `ITEM_SKU` VARCHAR(255), `VENDOR_CODE` VARCHAR(50), `ITEM_COST ` CURRENCY, `ITEM_SHIP_COST ` CURRENCY, `ITEM_TAX ` CURRENCY, `OPTION1_NAME ` VARCHAR(50), `OPTION1_VALUE ` VARCHAR(50), `OPTION2_NAME ` VARCHAR(50), `OPTION2_VALUE ` VARCHAR(50), `OPTION3_NAME ` VARCHAR(50), `OPTION3_VALUE ` VARCHAR(50))Basically what im saying is that i want a space after certain column names eg 'PROGRAM_ID ', 'NAME ' etc.But when the file exports, it doesnt put the space in. It just says 'PROGRAM_ID','NAME' etcHow do i get it to put the space in. This is using SSIS. I have this query in the Execute SQL Task Editor and the Excel Destination in the dataflow |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-04 : 09:14:53
|
you can add a derived column task in between which appends the space before putting the record values to destination |
 |
|
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 09:16:08
|
quote: Originally posted by visakh16 you can add a derived column task in between which appends the space before putting the record values to destination
I want the space in the header. EG: the names in the create statement |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-04 : 09:23:47
|
for that i think you need to use OPENROWSET or script task if in ssis |
 |
|
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 09:26:21
|
For that i am using Open rowset. But if i put the space in the column name in the create table sql, it doesnt do anything. Any other ideas?? |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2009-03-04 : 09:30:11
|
[PROGRAM_ID ]"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-04 : 09:37:14
|
quote: Originally posted by sgandhi For that i am using Open rowset. But if i put the space in the column name in the create table sql, it doesnt do anything. Any other ideas??
not in create table but just use select into after creating alises for each column with space |
 |
|
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 10:13:41
|
No, it has to be in the create table. Let me show you an exampleACTION PROGRAM_ID SUPPLIER_ID STORE_NAME ITEM_IDSTORE_CLEAR INTL 10102 Singapore OK, in the create script above, if i change the work in that create statment to program_ids it changes in the first line, thats what i expect it to do. But if i put a space at the end of it, it doesnt put that in. So it has to go in the create table, but i just dont know how to get it to show up in excel |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-04 : 10:19:15
|
arent you creating the table each time from valuesin excel? in that case cant you just use select into instead of create table? |
 |
|
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 10:31:02
|
Im so confused.Ok, this is what i have. 1)I have a execute sql task, which has the above sql in it (create table).2)Then i have taht linked to a dataflow. The source has a select statement in itSELECT [Catalog_Action] as Action ,[Program_Id] as 'Program_Id ' ,[Supplier_Id] ,[Store_Name] ,[Item_Id] ,[Item_Name_Local] as Name ,[Item_Name_English] ,[Item_Description_Local] as Description ,[Item_Description_English] ,[Category_Name_Local] as Category_Name ,[Category_Name_English] ,[Small_Image_URL] ,[Medium_Image_URL] ,[Large_Image_URL] ,[Is_Active] ,[Discontinue_Date] ,[Inventory_Count] ,[XML_Options] ,[XML_Attributes] ,[Is_Parent_Product] ,[Parent_Product_Id] ,[Var_Margin] ,[Brand] ,[Item_Sku] ,[Vendor_Code] ,[Item_Cost] ,[Item_Ship_Cost] ,[Item_Tax] ,[Option1_Name] ,[Option1_Value] ,[Option2_Name] ,[Option2_Value] ,[Option3_Name] ,[Option3_Value] ,[Original_Filename] FROM [b2r].[dbo].[International_Catalogs]where [Store_Name] = ?and [Supplier_Id] = ?and (left(right(original_filename,18),8) = ? or original_filename is null)order by Action desc3) Then i have data conversion, and multicast (cos im spliting it).4) Then the destination has a table or view data access mode and for the new sheet i use the same create table as above. NI dont know how to change this? to what you are trying to tell me. Please tell me step by step if i need to change soemthing.Thanks |
 |
|
sgandhi
Posting Yak Master
115 Posts |
Posted - 2009-03-04 : 12:08:29
|
Please somebody help me. Im incredibly stuck. I can send you my package if it helps |
 |
|
|
|
|
|
|