2010-10-13 20 views

回答

1

您不能在schema.ini中定義主鍵或任何其他索引。

您也不能有一個視圖大膽選擇鏈接服務器中的所有數據,並在其上定義唯一索引,因爲該視圖必須是with schemabinding才能啓用索引,並且這不適用於跨數據庫對象。

唯一可能的解決方案seems to be創建與主鍵選擇所有數據到表中的用戶定義的函數:

create function dbo.csv_primary() 
returns @result table (col1 int not null primary key, col2 varchar(255)) 
as 
begin 
    insert into @result(col1, col2) 
    select col1, col2 from CSVServer.[folder]..[file#csv]; 

    return; 
end; 

多步表值函數顯然會殺死的性能,但那麼,查詢csv文件時會獲得多少性能。

+0

感謝您的幫助信息 – datatoo 2011-06-13 12:42:18