Wednesday, December 7, 2011

How To Add new column to existing SQL Server Table

One of my student asked me, he wanted to modify existing SQL Server table by adding new column price (money). Table already has content so he does not want to recreate the table. He tried to use SQL Server Management Studio Table Designer but could not save the modified structure.

Solution : use this select - into query to create new table

Select * , cast(0 as money) as price into dbo.newtable from dbo.oldtable

This query will create new table name dbo.newtable with the structure same as oldtable plus additional new column (price) type money, and populate dbo.newtable from dbo.oldtable content.

1 comment:


  1. So is possible that HIV Disease can be cured because I have been scammed so many times not until I came across this great man Dr Akhigbe who helped me at first I never believe all this comment and post about him and I was very sick because I have been infected with HIV/AIDS for the past two year,just last 2 months I keep reading the testimony about this man named Dr Akhigbe they said that the man is so powerful he have cured different type of diseases, I keep monitoring his post of some people about this man and I found out that he was real so I decided to give him a trial I contacted him for help and he said he was going to help me get my cure that all I needed to do was to send him money to prepare the medication after which it will be sent to me via DHL courier delivery services which I did to my greatest surprise the medication was sent to me he gave me instructions to follow on how to drink it that after three weeks I should go for check up,after taking the medicine and follow his instruction after three weeks I went back to the hospital for another test, at first I was shocked when the doctor told me that I was negative I ask the doctor to check again and the result was still the same negative that was how I free from HIV VIRUS at of the shock I decided to come and share my own testimony with you for those who think there is no cure for HIV VIRUS the cure as finally come' out stop doubting and contact Dr Akhigbe via email drrealakhigbe@gmail.com he will help you out you can also whatsApp him via +2348142454860 he is also perfect in curing DIABETICS,HERPES,HIV/AIDS, ;ALS, CANCER ,HEPATITIS A AND B,ASTHMA, HEART DISEASE, CHRONIC DISEASE.,KIDNEY DISEASE, LUPUS,EXTERNAL INFECTION, EPILEPSY,STROKE, ECZEMA, EATING DISORDER etc believe me that deadly disease is not longer a deadly sentence because dr akhigbe has the cure.the godfather of herbal root.
    email: drrealakhigbe@gmail.com whatsapp number.
    +2348142454860
    website: https://drrealakhigbe.weebly.com

    ReplyDelete