Hi Guys,
So i've just been told that SELECT INTO cannot be used within a scalar function. Can anyone please tell me why?
Secondly, can I use a cursor on a view? and all within a function?
Thirdly, if not, can I define a cursor on various fields from four different tables using INNER JOIN i.e.:
DECLARE cursor_name CURSOR local SCROLL
FOR SELECT p.field_one, q.field_two, r.field_one
FROM Product p INNER JOIN Query q
ON p.ProductID = q.ProductID
INNER JOIN Racing r
ON q.RoadID = r.RoadID
WHERE p.ProductID = @PurchaseOrderI D
DECLARE VARIABLES HERE
OPEN CURSOR
I'm using SQL Server 2005 and working with the adventureworks sample database. Any help would be much appreciated.
Cheers,
Michelle
So i've just been told that SELECT INTO cannot be used within a scalar function. Can anyone please tell me why?
Secondly, can I use a cursor on a view? and all within a function?
Thirdly, if not, can I define a cursor on various fields from four different tables using INNER JOIN i.e.:
DECLARE cursor_name CURSOR local SCROLL
FOR SELECT p.field_one, q.field_two, r.field_one
FROM Product p INNER JOIN Query q
ON p.ProductID = q.ProductID
INNER JOIN Racing r
ON q.RoadID = r.RoadID
WHERE p.ProductID = @PurchaseOrderI D
DECLARE VARIABLES HERE
OPEN CURSOR
I'm using SQL Server 2005 and working with the adventureworks sample database. Any help would be much appreciated.
Cheers,
Michelle
Comment