Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974860
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:37:04+00:00 2026-05-20T04:37:04+00:00

I figure this is very easy, but I am trying to run this command

  • 0

I figure this is very easy, but I am trying to run this command only if those columns already don’t exist:

ALTER TABLE `surveytable` ADD IF NOT EXISTS  Survey_Name_Qualtrics VARCHAR(20);
ALTER TABLE `surveytable` ADD IF NOT EXISTS Survey_URL_Qualtrics VARCHAR(600);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:37:04+00:00Added an answer on May 20, 2026 at 4:37 am
        CREATE PROCEDURE addcol() BEGIN
          IF NOT EXISTS(
            SELECT * FROM information_schema.COLUMNS
            WHERE COLUMN_NAME='new_column' AND TABLE_NAME='the_table' AND TABLE_SCHEMA='the_schema'
            )
        THEN
            ALTER TABLE `the_schema`.`the_table`
            ADD COLUMN `new_column` bigint(20) unsigned NOT NULL default 1;
    
           END IF;
        END;
    
    
         delimiter ';'
    
         CALL addcol();
    
    DROP PROCEDURE addcol;
    

    This is the code that i use, i dont think you can use if not exists on a ALTER column.

    An alternative you can watch for the error you get if you try to insert a column that already exists, i think its 1062. And handle the error.

    Of course the better way is to not get the error in the first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This probably very easy when you know how, but I don't :) I'm trying
Ok so this i probably very easy but i can't seem to figure it
Probably very easy but I am having trouble to figure this out (also Google
this is probably very easy but I can't figure it out :) $('#myDiv').html('<a onclick=remove_item(variantId);>Remove</a>');
I feel very noobish asking this, but I can't seem to figure it out...
This seems like it should be an easy one but I can't figure it
I'm sure this is possible -- and probably very easy -- but I can't
This might be a very easy one for many of you - but I'm
Ok this should be easy but I can NOT figure it out. I have
Can't seem to figure this out, see code below. Trying to make a GET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.