1
我有簡單的SQL程序,該程序retrives XML數據,並顯示如下:SQL程序不顯示XML數據
ALTER PROCEDURE [dbo].[PROC_UTS_RATERECOMM_RECOMMDATA_XML_SET] (
@RETURN_CODE INT OUTPUT
,@RETURN_MESSAGE NVARCHAR(512) OUTPUT
,@XMLDATA xml
,@UTILITY_NAME NVARCHAR(50)
,@USER_CREATED_MODIFIED_BY NVARCHAR(50)
)
AS
BEGIN TRY
print '1'
select x.value('@UtilityName','nvarchar(50)') as UtilityName,
x.value('@SuggestedRate','nvarchar(50)') as SuggestedRate,
x.value('@Client','nvarchar(50)') as Client,
x.value('@State','nvarchar(50)') as State,
x.value('@CurrentRate','nvarchar(50)') as CurrentRate,
x.value('@AccNo','nvarchar(50)') as AccNo,
x.value('@Savings','nvarchar(50)') as Savings,
x.value('@tempSuggestedRate','nvarchar(50)') as tempSuggestedRate,
x.value('@tempClient','nvarchar(50)') as tempClient,
x.value('@tempCurrentRateSort','nvarchar(50)') as tempCurrentRate
--into tempTable
from
@XMLDATA.nodes('/temp')AS TEMPTABLE(x)
print '2'
END TRY
BEGIN CATCH
SET @RETURN_MESSAGE = CONVERT(NVARCHAR(2056), 'ERROR NUMBER :' + CONVERT(NVARCHAR,ERROR_NUMBER())
+ ', ERROR ON LINE :' + CONVERT(NVARCHAR,ISNULL(ERROR_LINE(),'')) + ', ' + ISNULL(ERROR_MESSAGE(),''))
EXECUTE PROC_UTS_APPLICATION_LOG_SET '', 'ERROR', @RETURN_MESSAGE ,NULL, NULL,''
SELECT @RETURN_CODE = @@ERROR
SELECT @RETURN_MESSAGE = 'ERROR WHILE FETCHING THE STATE RECORD!'
RETURN
END CATCH
--================================================================================--
-- RETURN SUCCESS TO THE CALLING OBJECT
--================================================================================--
SELECT @RETURN_CODE = 0
,@RETURN_MESSAGE = 'Record Fetch successfully!'
--================================================================================--
-- THE END.
我用以下語句執行該過程:
PROC_UTS_RATERECOMM_RECOMMDATA_XML_SET 0,'','<DocumentElement>
<temp>
<UtilityName>ALABAMA POWER</UtilityName>
<SuggestedRate>LPS</SuggestedRate>
<Client>PANTRY, THE</Client>
<State>Alabama</State>
<CurrentRate>LPS</CurrentRate>
<AccNo>0239808014</AccNo>
<Savings>-65</Savings>
<tempSuggestedRate>LPS</tempSuggestedRate>
<tempClient>PANTRY, THE</tempClient>
<tempCurrentRate>LPS</tempCurrentRate>
<tempCurrentRateSort>LPS-PANTRY, THE-ALABAMA POWER</tempCurrentRateSort>
<SellRate />
</temp>
<temp>
<UtilityName>ALABAMA POWER</UtilityName>
<SuggestedRate>LPS</SuggestedRate>
<Client>PANTRY, THE</Client>
<State>Alabama</State>
<CurrentRate>LPS</CurrentRate>
<AccNo>7267305034</AccNo>
<Savings>80</Savings>
<tempSuggestedRate>LPS</tempSuggestedRate>
<tempClient>PANTRY, THE</tempClient>
<tempCurrentRate>LPS</tempCurrentRate>
<tempCurrentRateSort>LPS-PANTRY, THE-ALABAMA POWER</tempCurrentRateSort>
<SellRate />
</temp>
</DocumentElement>','',''
但數據不顯示。
可能是什麼問題?
請指導我。
程序中沒有錯誤或異常。
待辦事項'1'和'2'打印? –
@Samcd是的,它確實打印所有 –
@Samcd是...但它沒用 –