473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Have a problem with using cursors in SQL server enterprise manager

Have a problem with using cursors in SQL server enterprise manager.
My code sql query is followed
---------------------------------------
DECLARE @element_name varchar(100)
DECLARE elements_cursor CURSOR FOR
SELECT element_name
FROM KB_Element_Ref

OPEN elements_cursor
FETCH NEXT FROM elements_cursor INTO @element_name

WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @element_name
FETCH NEXT FROM elements_cursor INTO @element_name
END

CLOSE elements_cursor
DEALLOCATE elements_cursor
------------------------------------------------------------
I have more than 100 rows int KB_Element_Ref table.
but when I execute this query, it said only a row has affected and did't
print any element_name.
does any one know what is going on?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
2 2357
your code is correct

are you sure the table is not empty?

Vaclav

"TaeHo Yoo" <an*******@devd ex.com> wrote in message
news:uN******** ******@TK2MSFTN GP10.phx.gbl...
Have a problem with using cursors in SQL server enterprise manager.
My code sql query is followed
---------------------------------------
DECLARE @element_name varchar(100)
DECLARE elements_cursor CURSOR FOR
SELECT element_name
FROM KB_Element_Ref

OPEN elements_cursor
FETCH NEXT FROM elements_cursor INTO @element_name

WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @element_name
FETCH NEXT FROM elements_cursor INTO @element_name
END

CLOSE elements_cursor
DEALLOCATE elements_cursor
------------------------------------------------------------
I have more than 100 rows int KB_Element_Ref table.
but when I execute this query, it said only a row has affected and did't
print any element_name.
does any one know what is going on?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
Try
<CODE>
DECLARE @element_name varchar(100)
DECLARE elements_cursor CURSOR FOR SELECT element_name FROM
KB_Element_Ref

SELECT COALESCE(elemen t_name,'Null Value') FROM KB_Element_Ref

OPEN elements_cursor
FETCH NEXT FROM elements_cursor INTO @element_name
WHILE @@FETCH_STATUS = 0

BEGIN
PRINT '<<' + @element_name + '>>'
FETCH NEXT FROM elements_cursor INTO @element_name
END

CLOSE elements_cursor
DEALLOCATE elements_cursor
</CODE>

in query analyzer to help check if a zero length string, or null is
being returned.
Rhys Gravell

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2983
by: Jaydeep | last post by:
Hello, I am facing a strange problem. Problem accessing remote database from ASP using COM+ server application having VB components (ActiveX DLL) installed. Tier 1 : ASP front End (IIS 5.0) Tire 2 : COM objects Tier 3 : SQL Server 2000 DB Flow is : ASP talks with COM objects and COM objects talks with DB Scenario 1
4
1980
by: Belinda | last post by:
Hello All I need to read a SQL Server table into a Web Page and within the Web Page to permit my users to make changes to the records, delete or add new records and then save the entire contents back to the SQL Server table back. The functionality I am looking is almost the same as In the SQL Enterprise Manager whereby I can choose a table open the table and then return all rows and I can maintain the same and save it back to
1
1256
by: Debbie Li | last post by:
Hi, I can not find any reference or support for the following issue from Microsoft or on Google: When I open a table either to return data or try to use the design tools or if I try to create a new database diagram, I get a new result pane, diagram pane etc... but no result and no functionality within that pane. The database is working and I can run querys using MS Query. The problem seems to be with MMC or Enterprise Manager.
1
6710
by: £ukasz | last post by:
Does anybody used BlackBerry Enterprise Server? Windows Server 2003 Enterprise Exchange Server 2003 Enterprise + SP1 SQL Server 2000 + SP4 Problem: Everything is instaled properly (I hope so) exactly as is written in manual (Creating database, adding users) but BlackBerry Manager can't connect to SQL database.
0
4536
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager Express Edition v1.3.2 Win, IBM Tivoli System Automation v1.2.0 Linux, IBM Tivoli Workload Scheduler Virtualized Data Centers v8.2 , other IBM Tivoli CDs, WEBSPHERE EVERYPLACE MOBILE PORTAL v5.0 - ALTIUM , other IBM WebSphere Business CDs...
7
2895
by: Mr Curious | last post by:
I have a problem with Enterprise Manager - when I refresh list of tables or databases it hangs (is not responding) for long time - about 10-30 minutes. What is more important during my refreshement users are unable to work normally - it hangs entire server. Some other details: 1. I am only dbo of one database with no administrative privilges. 2. There are no problems with Query Analyzer 3. Problem is related to one particular server - I...
7
3939
by: qintian | last post by:
hi all, i dunno should i post it here or not but i cant other place to post this problem .. i am using windows XP professional service pack 1 .. when i try to install MS SQL 2000 Developer Edition to my system, it can works fine except when i try to set the user name and password then it promp out this msg error msg : setup cannot verify/grant logon as service right to the sql server logon account : 1332(0X534)
6
24989
by: ilo | last post by:
When I want to delete a data from a table that this tabl has a trigger and this trigger reached another tables to delete the data in cursor I have this messeage: DELETE failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. My trigger : CREATE TRIGGER ON . FOR DELETE
4
7067
by: Jurgen Haan | last post by:
Hi hi everyone. We have upgraded our DB2 LUW 8.2.1 which was directly installed from our DB2 CD's to DB2 LUW 8.2.6 (FP13). (system: HP DL385 (AMD64), single socket, dual core. 8GB memory. SLES 10. NetApp FAS250 storage array). This went quite well, but it rendered our permanent (legal) DB2 license invalid, and I can see of no way to get our environment up and running with FP13 installed.
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.