Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stored procedure to change nulls in data 1

Status
Not open for further replies.

2969

IS-IT--Management
Oct 18, 2001
107
US
hi,

I have 15 tables that have NULLS entered in most of the records for 10 different fields in each of those tables. Is there a stored procedure I can make that would go in each of the record for each field and replace those nulls with 0.

I have this stored procedure that does not replaces the nulls with 0 or blanks..

PROCEDURE SetNullInv
USE Inv EXCLUSIVE
FOR i = 1 TO FCOUNT()
fieldname = FIELD(i)

IF TYPE('inv.'+ fieldname) = 'C' then
for j = 1 to 1000
REPLACE ('inv.'+ fieldname)with ' ' FOR ISNULL(('inv.'+ fieldname))
next j
ENDIF

IF TYPE('inv.'+ fieldname) = 'N' then
for j = 1 to 1000
REPLACE ('inv.'+ fieldname)with 0 FOR ISNULL(('inv.'+ fieldname))
next j
ENDIF

next i

ENDPROC
 
hi stella,

thanks for your help.. i figured it out last night how to work with parametrs and now I can just pass a table name as a paramater.. things work like a charm.

apprecaite your help..
TA
 

Glad you got it all sorted out.
Have fun.
Come back with more questions as you proceed.

Stella
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top