jadams0173
Technical User
- Feb 18, 2005
- 1,210
Is there a way to check and see if multiple columns(F19,F20,F21....) exist and if so drop them?
I'm importing data from an .xls file and sometimes there a lot extra columns that get imported but not always. It depends one what the users have done to the file before I import it. I've got a single statement to drop the columns but it errors if they are not there. Being new to SQL 2000 I'm unsure of the best method to handle this. Should I error trap or query the system tables to see if the columns exist?
What I have:
I'm importing data from an .xls file and sometimes there a lot extra columns that get imported but not always. It depends one what the users have done to the file before I import it. I've got a single statement to drop the columns but it errors if they are not there. Being new to SQL 2000 I'm unsure of the best method to handle this. Should I error trap or query the system tables to see if the columns exist?
What I have:
Code:
ALTER TABLE TEMPIMPORT DROP COLUMN F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,F23,F24,F25,
F26,F27,F28,F29,F30,F31,F32,F33,F34,F35,F36,F37,F38,F39,F40