我有一個名爲Percentages with a Column的表稱爲5StarResults,我想用存儲過程名稱5star的結果填充此表。將存儲過程的結果插入現有表
當我使用'Call 5star'時,它只返回一個百分比,我想把這個百分比插入Percentages表中。
請你幫忙,我試圖編輯程序來包含一個Insert,但它總是返回說0行插入。
謝謝
編輯,
存儲過程如下
BEGIN
declare Rating5Total int default 5;
declare Rating5Win int default 5;
declare 5StarPerformance decimal;
set Rating5Total = (select COUNT(Ratings) from vHighPerformance where Ratings = 7);
set Rating5Win = (select COUNT(Results) from vHighPerformance where Ratings = 7 and Results = 1);
set 5StarPerformance = Rating5Win*100.0/Rating5Total;
Select 5StarPerformance;
END
您可以發佈存儲過程'5star'的代碼? – wchiquito
你將需要使用臨時表,讓我試着嘲弄一下 – CSharper