2012-03-13 2 views
2

Я бегу на экспорт МАСТЕРА в плоский файл на SQL Server 2008.Экспорт данных из представления

я обеспечиваю запрос для этого процесса, который захватывает данные с точки зрения:

SELECT [Full Date] 
     ,[Year Entered] 
     ,[Month Entered] 
     ,[Day Entered] 
     ,[DOW] 
     ,[Week Ending] 
     ,[Accession] 
     ,[Sales Rep] 
     ,[MLNPI] 
     ,[IMSNPI] 
     ,[IMS Specialty Primary Code] 
     ,[Specialty Primary Description] 
     ,[IMS Specialty Secondary Code] 
     ,[Specialty Secondary Description] 
     ,[IMS Specialty Tertiary Code] 
     ,[Specialty Tertiary Description] 
     ,[IMS Professional ID 1] 
     ,[Physician] 
     ,[Practice Code] 
     ,[MLIS Code] 
     ,[Practice Name] 
     ,[Date Established] 
     ,[Address] 
     ,[Address2] 
     ,[City] 
     ,[State] 
     ,[Status] 
     ,[order count] 
     ,[Order Comments] 
     ,[Release Status] 
    FROM [SalesDWH].[dbo].[BySpecimenWITHOUTLOMDATA] 
    where [Year Entered]=2009 

I я получаю эти ошибки:

- Validating (Error) 
Messages 
Error 0xc00470d4: Data Flow Task 1: The code page on input column "Full Date" (142) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "DOW" (146) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Week Ending" (147) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Accession" (148) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Sales Rep" (149) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "MLNPI" (150) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "IMSNPI" (151) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "IMS Specialty Primary Code" (152) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Specialty Primary Description" (153) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "IMS Specialty Secondary Code" (154) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Specialty Secondary Description" (155) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "IMS Specialty Tertiary Code" (156) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Specialty Tertiary Description" (157) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "IMS Professional ID 1" (158) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Physician" (159) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Practice Code" (160) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "MLIS Code" (161) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Practice Name" (162) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Address" (164) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Address2" (165) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "City" (166) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "State" (167) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Status" (168) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Order Comments" (170) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc00470d4: Data Flow Task 1: The code page on input column "Release Status" (171) is 1252 and is required to be 65001. 
(SQL Server Import and Export Wizard) 

Error 0xc004706b: Data Flow Task 1: "component "Destination - 2009_txt" (106)" failed validation and returned validation status "VS_ISBROKEN". 
(SQL Server Import and Export Wizard) 

Error 0xc004700c: Data Flow Task 1: One or more component failed validation. 
(SQL Server Import and Export Wizard) 

Error 0xc0024107: Data Flow Task 1: There were errors during task validation. 
(SQL Server Import and Export Wizard) 

Кто-нибудь знает, что я делаю неправильно, и как я могу это исправить?

Я попытался обернуть столбцы в CAST:

/****** Script for SelectTopNRows command from SSMS ******/ 
SELECT cast([Full Date] as nvarchar) as [Full Date], 
cast([Year Entered] as nvarchar) as [Year Entered], 
cast([Month Entered] as nvarchar) as [Month Entered], 
cast([Day Entered] as nvarchar) as [Day Entered], 
cast([DOW] as nvarchar) as [DOW], 
cast([Week Ending] as nvarchar) as [Week Ending], 
cast([Accession] as nvarchar) as [Accession], 
cast([Sales Rep] as nvarchar) as [Sales Rep], 
cast([MLNPI] as nvarchar) as [MLNPI], 
cast([IMSNPI] as nvarchar) as [IMSNPI], 
cast([IMS Specialty Primary Code] as nvarchar) as [IMS Specialty Primary Code], 
cast([Specialty Primary Description] as nvarchar) as [Specialty Primary Description], 
cast([IMS Specialty Secondary Code] as nvarchar) as [IMS Specialty Secondary Code], 
cast([Specialty Secondary Description] as nvarchar) as [Specialty Secondary Description], 
cast([IMS Specialty Tertiary Code] as nvarchar) as [IMS Specialty Tertiary Code], 
cast([Specialty Tertiary Description] as nvarchar) as [Specialty Tertiary Description], 
cast([IMS Professional ID 1] as nvarchar) as [IMS Professional ID 1], 
cast([Physician] as nvarchar) as [Physician], 
cast([Practice Code] as nvarchar) as [Practice Code], 
cast([MLIS Code] as nvarchar) as [MLIS Code], 
cast([Practice Name] as nvarchar) as [Practice Name], 
cast([Date Established] as nvarchar) as [Date Established], 
cast([Address] as nvarchar) as [Address], 
cast([Address2] as nvarchar) as [Address2], 
cast([City] as nvarchar) as [City], 
cast([State] as nvarchar) as [State], 
cast([Status] as nvarchar) as [Status], 
cast([order count] as nvarchar) as [order count], 
cast([Order Comments] as nvarchar) as [Order Comments], 
cast([Release Status] as nvarchar) as [Release Status] 


    FROM [SalesDWH].[dbo].[BySpecimenWITHOUTLOMDATA] 
    where [Year Entered]=2009 

и получил сообща об ошибке:

- Setting Source Connection (Error) 
Messages 
Error 0xc0207016: Source - Query [1]: There is a data source column with no name. Each data source column must have a name. 
(SQL Server Import and Export Wizard) 

Exception from HRESULT: 0xC0207016 (Microsoft.SqlServer.DTSPipelineWrap) 
+0

если вы запускаете запрос на выборку со всеми присутствующими слепков, вы получите результаты, или вы получаете сообщение об ошибке? – Taryn

+0

@bluefeet возвращает результаты no prob –

+0

Если вы удалите пробелы из имен столбцов в ваших псевдонимах, вы все равно получите ошибку? – Taryn

ответ

1

Согласно this ответу должны изменить все столбцы в NVARCHAR типа данных.

+0

спасибо мост. Дело в том, что я не хочу менять какие-либо типы данных. невозможно экспортировать данные, когда его не nvarchar –

+0

btw Я не думаю, что ответ правильный, потому что я меняю свой запрос на SELECT CONVERT (nvarchar, [Full Date]) и т. д. ..... и все та же ошибка. msg –

+0

Вы можете измените тип данных в представлении, а не схему таблицы, - приведите каждый столбец к nvarchar в определении представления. Мои знания в области ниже, я боюсь, но по этой ссылке нет другого пути; вам нужны типы столбцов Unicode. – Bridge

1

Редактировать

Datatypes для столбцов в сообщении об ошибке необходимо изменить в NVARCHAR. Поскольку у вас есть требование не изменять вид, используйте CAST or CONVERT в запросе, чтобы изменить соответствующие столбцы. Я бы по-прежнему обеспечивал, чтобы кодовая страница UTF-8 была указана для целевого файла только для согласованности.

Оригинал

В/Экспорт мастера импорта, изменить кодовую страницу 65001 (UTF-8) для файла назначения.

Destination code page

+0

. он уже установлен в 65001 –

+0

Я также пробовал 65000 и просто unicode –

+0

спасибо.см. отредактированный вопрос –

Смежные вопросы