Tuesday, March 27, 2012

Delete Column

I want to delete a colum in a table using the following sql statement:
ALTER TABLE tblMarketing DROP COLUMN ThisYearMonthEnd10. In addition I only want to delete the column if it meets specific crietria. The crirtria is store in the table below. If the UdateMonth is not null then I want to delete.

FinancilaPeriodMonthUdateMonth
ThisYearMonthEnd01Jan
ThisYearMonthEnd02Feb
ThisYearMonthEnd03Mar
ThisYearMonthEnd04Apr
ThisYearMonthEnd05May
ThisYearMonthEnd06Jun
ThisYearMonthEnd07Jul
ThisYearMonthEnd08Aug
ThisYearMonthEnd09Sep
ThisYearMonthEnd10OctOct
ThisYearMonthEnd11Nov
ThisYearMonthEnd12Dec

Can anyone help.

ThanksI want to delete a colum in a table using the following sql statement:
ALTER TABLE tblMarketing DROP COLUMN ThisYearMonthEnd10. In addition I only want to delete the column if it meets specific crietria. The crirtria is stored in the table below. If the UdateMonth is not null then I want to delete.

FinancilaPeriod Month UdateMonth
ThisYearMonthEnd01 Jan
ThisYearMonthEnd02 Feb
ThisYearMonthEnd03 Mar
ThisYearMonthEnd04 Apr
ThisYearMonthEnd05 May
ThisYearMonthEnd06 Jun
ThisYearMonthEnd07 Jul
ThisYearMonthEnd08 Aug
ThisYearMonthEnd09 Sep
ThisYearMonthEnd10 Oct Oct
ThisYearMonthEnd11 Nov
ThisYearMonthEnd12 Dec

Can anyone help.

Thanks|||------------------------

I want to delete a colum in a table using the following sql statement:
ALTER TABLE tblMarketing DROP COLUMN ThisYearMonthEnd10. In addition I only want to delete the column if it meets specific crietria. The crirtria is stored in the table below. If the UdateMonth is not null then I want to delete.

FinancilaPeriod Month UdateMonth
ThisYearMonthEnd01 Jan
ThisYearMonthEnd02 Feb
ThisYearMonthEnd03 Mar
ThisYearMonthEnd04 Apr
ThisYearMonthEnd05 May
ThisYearMonthEnd06 Jun
ThisYearMonthEnd07 Jul
ThisYearMonthEnd08 Aug
ThisYearMonthEnd09 Sep
ThisYearMonthEnd10 Oct Oct
ThisYearMonthEnd11 Nov
ThisYearMonthEnd12 Dec

Can anyone help.

Thanks|||------------------------

I want to delete a colum in a table using the following sql statement:
ALTER TABLE tblMarketing DROP COLUMN ThisYearMonthEnd10. In addition I only want to delete the column if it meets specific crietria. The crirtria is stored in the table below. If the UdateMonth is not null then I want to delete.

FinancilaPeriod Month UdateMonth
ThisYearMonthEnd01 Jan
ThisYearMonthEnd02 Feb
ThisYearMonthEnd03 Mar
ThisYearMonthEnd04 Apr
ThisYearMonthEnd05 May
ThisYearMonthEnd06 Jun
ThisYearMonthEnd07 Jul
ThisYearMonthEnd08 Aug
ThisYearMonthEnd09 Sep
ThisYearMonthEnd10 Oct Oct
ThisYearMonthEnd11 Nov
ThisYearMonthEnd12 Dec

Can anyone help.

Thanks|||A table is nothing more then a collection of columns. If you want to remove a column you do it for the entire table. You cannot just drop a column for one specific row when it contains some data. When you drop a column, it removes that entire column from the table, data or not.

Ronald :cool:.|||

Quote:

Originally Posted by shieldsco

------------------------

I want to delete a colum in a table using the following sql statement:
ALTER TABLE tblMarketing DROP COLUMN ThisYearMonthEnd10. In addition I only want to delete the column if it meets specific crietria. The crirtria is stored in the table below. If the UdateMonth is not null then I want to delete.

FinancilaPeriod Month UdateMonth
ThisYearMonthEnd01 Jan
ThisYearMonthEnd02 Feb
ThisYearMonthEnd03 Mar
ThisYearMonthEnd04 Apr
ThisYearMonthEnd05 May
ThisYearMonthEnd06 Jun
ThisYearMonthEnd07 Jul
ThisYearMonthEnd08 Aug
ThisYearMonthEnd09 Sep
ThisYearMonthEnd10 Oct Oct
ThisYearMonthEnd11 Nov
ThisYearMonthEnd12 Dec

Can anyone help.

Thanks


hi,can u please tell me, do u want to delete a column or a row? if u really want to delete a row whose FinancilaPeriod Month value is ThisYearMonthEnd10. u can use the following statement
delete from tblMarketing where FinancilaPeriodMonth = 'ThisYearMonthEnd10'

I hope i understood ur problem correctly.|||

Quote:

Originally Posted by Anu139

hi,can u please tell me, do u want to delete a column or a row? if u really want to delete a row whose FinancilaPeriod Month value is ThisYearMonthEnd10. u can use the following statement
delete from tblMarketing where FinancilaPeriodMonth = 'ThisYearMonthEnd10'

I hope i understood ur problem correctly.


I really want to delete a column based on the following example:
Table 1
FinancilaPeriodMonthUdateMonth
ThisYearMonthEnd01Jan
ThisYearMonthEnd02Feb
ThisYearMonthEnd03Mar
ThisYearMonthEnd04Apr
ThisYearMonthEnd05May
ThisYearMonthEnd06Jun
ThisYearMonthEnd07Jul
ThisYearMonthEnd08Aug
ThisYearMonthEnd09Sep
ThisYearMonthEnd10OctOct
ThisYearMonthEnd11Nov
ThisYearMonthEnd12Dec

Table 2
ThisYearMonthEnd01ThisYearMonthEnd02ThisYearMonthEnd10
I want to delete the cloumn ThisYearMonthEnd10 in Table 2 based on the the UdateMonth in table 1.|||Hi shieldsco,

I hope you are getting the help you want. However I would like to request that in future you don't double (or in this case quadruple) post the same question to the same forum.

If you think you question/problem has been overlooked then please post a reply to it yourself so that it gets bumped to the top of the Forum list.

I have now merged your 4 threads on this subject into this single thread.

Regards
Banfa|||

Quote:

Originally Posted by Banfa

Hi shieldsco,

I hope you are getting the help you want. However I would like to request that in future you don't double (or in this case quadruple) post the same question to the same forum.

If you think you question/problem has been overlooked then please post a reply to it yourself so that it gets bumped to the top of the Forum list.

I have now merged your 4 threads on this subject into this single thread.

Regards
Banfa


Actually two of threads were futher explanation of the problem.

No comments:

Post a Comment