Solved

SQL CODE REVERSE

Posted on 2007-11-15
6
175 Views
Last Modified: 2010-03-20
Could someone please tell me what code I should use to reverse the first line of the follwing code and remove the table that was created in my database?

ALTER TABLE newsletters ADD template varchar(64) AFTER locked;
CREATE TABLE `newsletters_to_products` (
`newsletter_id` INT( 11 ) DEFAULT '0' NOT NULL ,
`products_id` INT( 11 ) DEFAULT '0' NOT NULL ,
PRIMARY KEY ( `newsletter_id` , `products_id` )
);

Many thanks
0
Comment
Question by:Nicci_Leitch
  • 3
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 250 total points
ID: 20289617
ALTER TABLE newsletters DROP COLUMN template;
DROP TABLE newsletters_to_products;
0
 
LVL 26

Assisted Solution

by:Zberteoc
Zberteoc earned 250 total points
ID: 20289658
--to remove the template column:
ALTER TABLE newsletters DROP COLUMN template

-- to remove the created table:
DROP TABLE newsletters_to_products


however, the AFTER locked clause is not part of SQL synthax, as I know, and
the CREATE sythax is wrong because for INT (integer) type you don't specify size lke (11). so I doobt it run succesfully.
0
 

Author Comment

by:Nicci_Leitch
ID: 20290147
Zberteoc:
Blimey! I have spent days trying to get this working properly due to some error and even after everyone's galant efforts of trying to help me, I decided to scrap it as it just wasn't happening, hence needing the reversal.

Now I'm thinking that because of the error you've pointed out, this could have been the route of the problem. (I don't know as I'm not too clever when it comes to this kind of thing, hence why I try to get help wherever I can!)

Thank you for your help
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 11

Expert Comment

by:Angelp1ay
ID: 20290250
0
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 20290282
0
 

Author Comment

by:Nicci_Leitch
ID: 20290316
Thank you both very much.  Its much appreciated.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question