![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have used a cursor to return the required result from a db table in order for me to use in an ASP/VBScript webpage. This is the first time I have used a cursor and am having problems. |
#3
| |||
| |||
|
|
Hi, I would much appreciate some help with a work project that is due very soon. I have used a cursor to return the required result from a db table in order for me to use in an ASP/VBScript webpage. This is the first time I have used a cursor and am having problems. |
#4
| |||
| |||
|
|
"Simon Barnett" <sb (AT) simonnospambarnett (DOT) com> wrote in message news:xARpi.21338$2U6.5520 (AT) fe1 (DOT) news.blueyonder.co.uk... Hi, I would much appreciate some help with a work project that is due very soon. I have used a cursor to return the required result from a db table in order for me to use in an ASP/VBScript webpage. This is the first time I have used a cursor and am having problems. Don't use a cursor. If you are inexperienced with SQL then it's better not to use cursors at all. Instead, always try for a single query solution. Find some examples to expand your knowledge of set-based SQL or get some advice and assistance. Here's my guess of what you intended. It's untested. If you had posted DDL and sample data I could have tested it out. SELECT KeyAccountability AS col1, 'keyacc' AS rowtype FROM KeyAccountability WHERE category = @var1 AND jobprofileid = @jobprofileID UNION SELECT category AS col1, 'cat' AS rowtype FROM KeyAccountability WHERE category = @var1 AND jobprofileid = @jobprofileID; -- David Portas, SQL Server MVP Whenever possible please post enough code to reproduce your problem. Including CREATE TABLE and INSERT statements usually helps. State what version of SQL Server you are using and specify the content of any error messages. SQL Server Books Online: http://msdn2.microsoft.com/library/m...S,SQL.90).aspx -- |
#5
| |||
| |||
|
|
Simon Barnett wrote: I have used a cursor to return the required result from a db table in order for me to use in an ASP/VBScript webpage. This is the first time I have used a cursor and am having problems. Why is a cursor being used? Have you tried rewriting it without one? |
#6
| |||
| |||
|
|
Are cursors deemed as bad practice? Everyone I have spoken to says to avoid them. |
![]() |
| Thread Tools | |
| Display Modes | |
| |