Drop all columns except the few I want

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 124
Accepted Solution

Drop all columns except the few I want

Greetings all.  I'm hitting a DB2 table that has around 100 columns, and I only want 5 of them.  Is there a quick way to drop them all excluding the 5 I want, without having to explicitly type them all out in a drop statement?

Greg


Accepted Solutions
Solution
‎10-03-2012 04:20 PM
Super User
Posts: 10,516

Re: Drop all columns except the few I want

Instead of DROP=  use KEEP= for the variables you want.

The pain is when the desired number is about half of the variables...


View solution in original post


All Replies
Solution
‎10-03-2012 04:20 PM
Super User
Posts: 10,516

Re: Drop all columns except the few I want

Instead of DROP=  use KEEP= for the variables you want.

The pain is when the desired number is about half of the variables...


Frequent Contributor
Posts: 124

Re: Drop all columns except the few I want

Thank you, I knew it had to be something easy like that.

Greg

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 221 views
  • 0 likes
  • 2 in conversation