I created a stored procedure to output data from a products table ordered by
a column name passed to the procedure from my Cold Fusion script. The only
problem with it is that it doesn't order the rows in the correct order, it
just gives the default ordering (the order they were entered in the db)
What am I missing in this code?? Messing with the @OrderBy variable in the
ORDER BY section doesn't help much... taking away the quotes or giving it
double quotes doesn't give the desired results either.
Thanks for whatever help you can give.
CREATE PROCEDURE sp_ProcedureName @OrderBy varchar(50)
AS
SELECT A.Name AS ProductName,
ID_Product,
PartNumber,
Price,
Description_Brief,
Active,
ImageName,
B.Name AS VendorName,
B.ID_Vendor,
C.Name AS Availability
FROM Products A, Vendor B, Products_Availabilty C
WHERE A.ID_Vendor=B.ID_Vendor AND A.ID_Availabilty=C.ID_Availabilty AND
A.Active=1
ORDER BY '@OrderBy'
RETURN
GO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists