Solved

SQL CODE REVERSE

Posted on 2007-11-15
6
172 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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now