Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Delete and Give Name Fields (rename, alias..)

Hi QV experts!

I am trying to do something in the load script but it seems that i am missing something.. hope that you can help me out. I will give you a simplified version of my problem.

I have a field A and a field B in the same table.

I want to delete the field A and rename the field B as A.

What i do is:

Drop A;

Rename B to A;

This doesn't give error but,  below, the code uses the field A for some calculations (I want this field A to have the values of the field B, this is why i do the name change). And at this point the error comes out.    Field Not Found - <A>

How could i solve it!?

Thanks!!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks to everyone for the help and the interest. I dont really understand why, as the script is huge and messy (someone made it a long time ago and no one at my company fully understands it). Nevertheless i came p with something that worked out:

-I created a new table with the sa<ame fields as the old one, i deleted the old one, did the change in the new one and then rename it as the old one. Here it is:

#TABLE:

     Load *

Resident TABLE;

Drop table TABLE;

Drop field A from #TABLE;

Rename Field B To A;

Rename Table #TABLE To TABLE;

Thanks for the help!

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

Why don't you do this?

LOAD A,

           A AS B

FROM yoursourceTable;

Drop A;

mdmukramali
Specialist III
Specialist III

Hi,

Try

Load

B as A

from -----------------------;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Could you post the actual script or a part of the document log that shows the code you are using?

-Rob

Peter_Cammaert
Partner - Champion III
Partner - Champion III

When you try to rename B into A, fields A and B are only present in this single table? And there isn't already a field called B in that table?

It seems to work for me:

Delete and give name fields thread282153.jpg

RawData:

LOAD ID, A, A*2 AS B INLINE [

ID, A

1, 5

2, 7

3, 11

4, 2

5, 20

];

DROP Field A;

RENAME Field B TO A;

ProcessedData:

NOCONCATENATE

LOAD ID, A / 100.0 AS Percentage

RESIDENT RawData;

Anonymous
Not applicable
Author

Thanks to everyone for the help and the interest. I dont really understand why, as the script is huge and messy (someone made it a long time ago and no one at my company fully understands it). Nevertheless i came p with something that worked out:

-I created a new table with the sa<ame fields as the old one, i deleted the old one, did the change in the new one and then rename it as the old one. Here it is:

#TABLE:

     Load *

Resident TABLE;

Drop table TABLE;

Drop field A from #TABLE;

Rename Field B To A;

Rename Table #TABLE To TABLE;

Thanks for the help!