Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SMO.Transfer和filestreaming_Sql Server_Smo_Sql Server 2008 R2 - Fatal编程技术网

Sql server SMO.Transfer和filestreaming

Sql server SMO.Transfer和filestreaming,sql-server,smo,sql-server-2008-r2,Sql Server,Smo,Sql Server 2008 R2,是否有人设法使传输机制与FILESTREAM列一起工作 我的代码如下: Transfer transfer = new Transfer(sourceDatabase); transfer.CopyAllObjects = true; transfer.DropDestinationObjectsFirst = true; transfer.CopySchema = true; transfer.CopyData = false; transfer.CopyAllTables = true;

是否有人设法使传输机制与FILESTREAM列一起工作

我的代码如下:

Transfer transfer = new Transfer(sourceDatabase);
transfer.CopyAllObjects = true;

transfer.DropDestinationObjectsFirst = true;
transfer.CopySchema = true;
transfer.CopyData = false;
transfer.CopyAllTables = true;
transfer.Options.WithDependencies = true; 

transfer.DestinationServer = server.Name;
transfer.DestinationDatabase = targetDatabaseName;

transfer.TransferData();
我在创建包含filestreaming列的表时收到错误消息:

“错误:errorCode=-1073548784 description=执行查询…失败,出现以下错误:“具有FILESTREAM列的表必须具有非NULL唯一ROWGUID列。”。可能的失败原因:查询问题、“ResultSet”属性设置不正确、参数设置不正确或连接建立不正确。 helpFile=helpContext=0 idofInterfaceWithError={C81DFC5A-3B22-4DA3-BD3B-10BF861A7F9C}”


这很奇怪,因为源表肯定设置了这些属性。我是否遗漏了传输过程的一部分?

奇怪的是,这很好:

//transfer.TransferData();

System.Collections.Specialized.StringCollection script = transfer.ScriptTransfer();

Microsoft.SqlServer.Management.Smo.Database targetDatabase = server.Databases["dbname"];
targetDatabase.ExecuteNonQuery(script);

有人能解释一下吗?为什么传输会失败,但生成和运行脚本工作正常?

奇怪的是,这工作正常:

//transfer.TransferData();

System.Collections.Specialized.StringCollection script = transfer.ScriptTransfer();

Microsoft.SqlServer.Management.Smo.Database targetDatabase = server.Databases["dbname"];
targetDatabase.ExecuteNonQuery(script);

有人能解释一下吗?为什么传输会失败,但生成和运行脚本工作正常?

这是解决方案,但我不知道为什么。这是解决方案,但我不知道为什么。