2014-09-22 63 views
0

我試圖使用它們提供的存儲過程來監視SQL Server 2005複製。SQL Server 2005 SP調用在SSMS中工作,但不使用tiny_tds

我可以運行在SSMS以下,並得到數據:

exec sp_replmonitorhelpsubscription 
    @publisher = 'publisher', @publication = 'publication', @publication_type = 0 

如果我使用tiny_tds運行相同的查詢我得到如下:

mssql = TinyTds::Client.new(
     :dataserver => config[:host], 
     :port => config[:port], 
     :username => config[:username], 
     :password => config[:password], 
     :database => db 
    ) 
result = mssql.execute("exec sp_replmonitorhelpsubscription @publisher='publisher', @publication='publication', @publication_type=0") 

........ .......

MSSQLCheck WARNING: query did not complete: Cannot insert the value NULL into column 'publication_id', table 'tempdb.dbo.#tmp_replication_monitordata________________________________________________________________________________________000000001A64'; column does not allow nulls. INSERT fails. 

我沒有運氣在任何地方發現這個特定的錯誤。誰能幫忙?

回答

0

我懷疑tiny_tds可能不會設置沒有NULLNOT NULL規範默認NOT NULL創建ANSI_DEFAULTS ON如此列。在執行proc之前,嘗試執行SET ANSI_DEFAULTS ONSET ANSI_NULL_DFLT_ON ON

+0

我永遠不會想到我自己,但那是問題所在。非常感謝你! – numb3rs1x 2014-09-23 00:41:02

相關問題