Hi
Write a script that creates a cursor for a result set that consists of the ProductName and ListPrice columns for each product with a list price that's greater than $700. The rows in this result set should be sorted in descending sequence by list price. Then, the script should print the product name and list price for each product so it looks something like this:
Gibson SG, $2517.00
Gibson Les Paul, $1199.00
Thank you

Sunny SharmaPosted Oct 15, 2013, 1:44 AM
Here you go:
----------------------------------------------
PRODUCTS is the name of the referenced table.
Cheers !!
SUNIL GUTTAPosted Oct 15, 2013, 2:10 AM
Jignesh TrivediPosted Oct 15, 2013, 1:57 AM
I think this can be achieved with out cursor.... as u know cursor is costly in term of memory consumption..
like
SELECT ProductName + ' $' + Cast(ListPrice AS VARCHAR(20)) AS Result FROM PRODUCTS WHERE ListPrice>700 ORDER BY ListPrice DESC
hope this will help you.
Sunny SharmaPosted Oct 15, 2013, 1:56 AM