![](/img/trans.png)
[英]Is there any way to generate database scripts from a SQL query in SQL Server?
[英]Generate SQL scripts from Azure SQL Database
當我嘗試從Azure
數據庫在SQL Server Management Studio 2012
生成腳本時。 我收到以下錯誤:
Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptPublishException:編寫對象腳本時發生錯誤。 ---> Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException:無法檢索此請求的數據。 ---> Microsoft.SqlServer.Management.Sdk.Sfc.InvalidVersionEnumeratorException:版本11.0 SqlAzureDatabase不支持該操作。 在Microsoft.SqlServer.Management.Smo.XmlReadDoc.LoadFile(組件a,字符串strFile)在Microsoft.SqlServer.Management.Smo.SqlObject.LoadInitData(字符串文件,ServerVersion ver,DatabaseEngineType databaseEngineType)在Microsoft.SqlServer.Management.Sdk。 Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.GetElement(ObjectLoadInfo oli,ServerVersion ver,DatabaseEngineType ver,DatabaseEngineType databaseEngineType)在Microsoft.SqlServer.Management.Sdk.Sfc的Sfc.ObjectCache.LoadElement(ObjectLoadInfo oli,ServerVersion ver,DatabaseEngineType databaseEngineType)。 Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetObjectsFromCache(Urn urn,Object ci)上的ObjectCache.GetAllElements(Urn urn,ServerVersion ver,DatabaseEngineType databaseEngineType,Object ci)在Microsoft.SqlServer.Management.Sdk.Sfc.Environment上。 Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator上的GetData(請求要求,對象ci).Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(對象上的GetData(對象連接信息,請求請求) connectionInfo,Request request)-內部異常堆棧跟蹤的結尾-Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo,Request request)在Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorData Microsoft.SqlServer.Management.Smo.Server.GetLCIDCollation(String collationName)上的(請求要求)Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetComparerFromCollation(String collationName)上的Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetDbComparer(Boolean) Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitializeStringComparer()的Microsoft.SqlServer.Management.Smo.Database.PreInitChildLevel()的Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn levelFilter,ScriptingPreferences sp,Boolean Microsoft.SqlServer.Management.Smo.DatabasePrefetchBase.InitializeObjectCollection(字符串類型)的Microsoft.SqlServer.Management.Smo.DatabasePrefetchBase.d__1.MoveNext()的Microsoft)
1 discoveredUrns) at Microsoft.SqlServer.Management.Smo.SmoDependencyDiscoverer.Discover(IEnumerable
.Management.Smo.SmoDependencyDiscoverer.SfcChildrenDiscovery(HashSet1 discoveredUrns) at Microsoft.SqlServer.Management.Smo.SmoDependencyDiscoverer.Discover(IEnumerable
foundUrns),Microsoft的Microsoft.SqlServer.Management.Smo.ScriptMaker.Discover(IEnumerable1 urns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker的1 urns) at Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable
1個對象)(Microsoft Internet.SqlServer.Management.Smo.ScriptMaker.Script(List`1 urns,ISmoScriptWriter writer)的列表]缸,ISmoScriptWriter作家)在Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.DoScript(ScriptOutputOptions outputOptions)-內部異常堆棧跟蹤的結尾-在Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, System.ComponentModel.BackgroundWorker.OnDoWork上的DoWorkEventArgs e)(System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object參數)上的DoWorkEventArgs e)
我找到了這個線程: 無法為Sql Azure數據庫生成腳本:“從:獲取對象列表失敗”,但是我不能使用: http://cloudservices.red-gate.com/
: http://cloudservices.red-gate.com/
嘗試為SQL Server使用能夠與Azure一起使用的第三方工具。 我認為Red-Gate的SQL Compare可以使用SQL Azure,但我不確定100%。 您始終可以在試用模式下使用它來完成工作…
SQL Azure遷移向導也可能是您的選擇。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.