/*
使用方法
如
查詢該系列Cylindrical
dbo
查詢系列Cylindrical
dbo
*/
CREATE PROCEDURE P_GetSeriesProductDetail(@series_guid varchar(
AS
DECLARE @ParamNo nvarchar(
DECLARE @SQL nvarchar(
Set @SQL=
DECLARE P_cursor CURSOR
local
fast_forward
FOR SELECT param_no FROM V_product_params where series_guid=@series_guid
OPEN P_cursor
FETCH next FROM P_cursor INTO @ParamNo
WHILE (@@fetch_status =
BEGIN
Set @SQL = @SQL +
FETCH next FROM P_cursor INTO @ParamNo
END
CLOSE P_cursor
DEALLOCATE P_cursor
Set @SQL=
FROM V_product_params WHERE series_guid=
if (LTrim(@condition)<>
Set @SQL= @SQL +
Set @SQL= @SQL +
GROUP BY type_guid
Print @SQL
Execute sp_executesql @SQL
From:http://tw.wingwit.com/Article/program/MySQL/201311/29566.html