Solved

SQL CODE REVERSE

Posted on 2007-11-15
6
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 27

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
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

728 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