Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 not being able to proces new table column

Author  Topic 

wc67
Starting Member

2 Posts

Posted - 2011-01-26 : 12:15:30
I am have a problem being able to access and update a new column added to a table. I believe that someplace the structure of the statements is set up incorrectly and/or I just don’t understand how it should work, but since this is new to me, I am not sure on how to get it to work. I am not getting past the ‘Fetch’ statement.


I added a new column to a table. The existing process does a ‘Declare Cursor’ and ‘Fetch’ and then either ‘Insert’ or ‘Update’

Table_structure
Field 1
Field 2
Field 3
Field 4
Field 5
Field 6
New field

Within my program I am issuing the ‘Declare Cursor’ but am not going to be updating field 5 or 6 so I did not include them in the declare.

Declare cursor
Field 1
Field 2
Field 3
New field


Fetch
Field 1
Field 2
Field 3
New field

When I issue the ‘Fetch’ I get a ‘FATAL SQL ERROR HAS OCCURRED, SQLCODE = 000000001-, SQLERRMC = PERCobol
SQL: 22002.R11: Null value, no indicator.

Any suggestions/clarifications would be appreciated.













visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-26 : 12:21:01
you can access the fields of table from information_schema.columns table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-01-26 : 12:39:35
posting the actual code would be a big help...but I am suspect about your use of a cursor



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-01-26 : 12:41:20
So you are using COBOL to query against a SQL Databse.
Is it MS SQL Server or another DBMS like ORACLE?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

wc67
Starting Member

2 Posts

Posted - 2011-01-26 : 12:50:48
MS SQL Server
Go to Top of Page
   

- Advertisement -