How to insert columns in an existing table?

iv read the tutorial in this site http://www.w3schools.com/sql/sql_alter.asp but it is not for SQL Server 2000 DB.
Im using SQL Server 2000 DB. how do i insert column in an existing table?
i tried to execute the code (String query) below but it doesn't wrk:
For data type char:
String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [char] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL";
For data type int:
String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [int] NOT NULL";________________________
is what's wrong with the code?

Best solution would be to look up the exact syntax from the SQL Server 2000 documentation. The tutorial you have there teaches the ANSI Standard SQL. It is surprising that SQL Server 2000 (Microsoft right?) doesn't comply with that (especially since they list it in as one of the ones the tutroial was made to demonstrate).
I would double and triple check your sintax, whatch your error logs to make sure something else isn't preventing you from changing, and making sure you are logged in to the DB as a user who has the ability to alter tables.

Similar Messages

  • How to add an unique column to an existing table?

    How to add an unique column to an existing table?
    I have a large table which has no unique constraint. and I want to add an unique column for it. How to do it?
    Does adding a sequence is a good choice? How to do it?
    Thank you

    Hi,
    alter table tablename
    add constraint contraint_name unique (columnname);but before that you need to check in the table.column there is no duplicate record exist.
    Does adding a sequence is a good choice?
    Your talking about unique constraint then yes.
    Regards,
    Taj

  • Need to add 2 new columns to the existing table control of C223 transaction

    Hi ABAP Gurus,
    I have to do a screen enhancement for transaction C223.
    Below is the requirement:
    need to add 2 new columns to the existing table control of C223 transaction.
    there is no customer exits, screen exit or user exit present for this transaction C223, i have found one enhancement spot for this transaction.
    i dont have any idea how to do this in standard transaction C223, the table control in C223 saves the data to MKAL table and the table control uses the structure MKAL_EXPAND in the screen program.
    i have created an append structure for  the 2 fields to the standard table MKAL.
    Can anyone please suggest me how this can be done in standard screen C223, will the enhancement spot can be used to do this....
    please sugest...
    Thanks & Regards

    Hi Santosh,
    Thanks for the reply. I have looked into this Enhancement Spot CPFX_SCREEN_SET , inside this there is only one method INPUT_DISABLED having below parameters
    IM_MKAL     Importing     Type     MKAL                                                                                Production Version
    EX_MSGID     Exporting     Type     SY-MSGID                                                                                Messages, Message
    EX_MSGTY     Exporting     Type     SY-MSGTY                                                                                Messages, Message
    EX_MSGNO     Exporting     Type     SY-MSGNO                                                                                Messages, Message
    EX_MSGV1     Exporting     Type     SY-MSGV1                                                                                Messages, Message
    EX_MSGV2     Exporting     Type     SY-MSGV2                                                                                Messages, Message
    EX_MSGV3     Exporting     Type     SY-MSGV3                                                                                Messages, Message
    EX_MSGV4     Exporting     Type     SY-MSGV4                                                                                Messages, Message
    EX_INPUT_DISABLE     Exporting     Type     CHAR1                                                                                Display Only if X Was Set
    the BADI definition present here is a SAP internal so we cant implement the BADI , but we can created a enhancement spot implementation for this. as per my understanding on this the enhancement spot is only for making the table control fields display / change .  i dont think this can be used to add two new coloumns to C223 table control.
    I am not sure thats why seeking your help/valuable sugestion on this.
    Please provide your sugestion on this , so that i can come to conclusion on this issue.
    Thanks & Regards
    Siddhartha Mishra

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • How to insert into more than one table at a time also..

    hi,
    i am a newbee.
    how to insert into more than one table at a time
    also
    how to get a autoincremented value of an id say transactionid for a particular accountid.
    pls assume table as
    transactionid accountid
    101 50
    102 30
    103 50
    104 35
    i want 102 for accountid 30 and 103 for accountid 50.
    thank u

    @blushadow,
    You can only insert into one table at a time. Take a look here :
    Re: insert into 2 tables
    @Raja,
    I want how to extract the last incremented value not to insert.Also, I don't understand your thread title... which was "how to insert into more than one table at a time also.. "
    Insert, extract... ? Can you clarify your job ?
    Nicolas.

  • How to find the list of existing tables in a schema using DB link?

    Hi
    I know how to find the list of existing tables in a schema using the following query
    SQL> select * from tab;
    but, how to list the tables using a DB link?
    For Example
    SQL> select * from tab@dblink_name;
    why this doesn't work?
    Pl advice me
    Thanks
    Reddy.

    ORA-02019: connection description for remote database not foundHave you used this database link successfully for some other queries?
    The error posted seems to indicate that the DB Link is not functional at all. Has it worked for any other type of DML operation or is this the first time you ever tried to use the link?

  • How to insert a record in ROOSPRMSC table? (accidentally deleted)

    Calling an InfoPackage in BW causes short dump, while fixing the short dump issue, accidentally
    deleted the "ROOSPRMSC" table entries.
    Could you tell me how to insert a record in "ROOSPRMSC" table???

    Hi Senthil,
    Regards,
    Phani Raj Kallur
    Message was edited by: Phani Raj Kallur

  • How to create a partition on existing table?

    Hey
    Could some one please tell me on how to create a partition on existing table?

    Could some one please tell me on how to create a partition on existing table?
    You can't - that isn't possible. Unless a table is already partitioned you can NOT create another partition on it.
    You must either redefine the table as a partitioned table (using the DBMS_REDEFINITION package) or create a new partitioned table and move the data to its new partitions.
    The choice will depend on how much data the existing table has and whether you can do it offline.

  • How to insert  Legacy data into QP_RLTD_MODIFIERS table?

    How to insert  Legacy data into QP_RLTD_MODIFIERS table in R12 instance.

    I would use the API QP_Modifiers_PUB.Process_Modifiers for pushing legacy pricing data into R12.  QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environnment, only promos have data in this table).

  • How to add a new column to a existing table?

    Hi all,
    I have requriment acc which i need toadd a new column to a exsiting table.the name of the columns is taken frm database.I.e.,
    say if i have 3 names in DB name1,name2,name3
    i need to add in the table these three names as columns and tat to as inputfield(tablecelleditor) .Please help me with the code, i'll give full points to everyone who gives me correct answer 
    Regards
    Sharan and please this is Really Urgent!!! plzzzzzzzzzz
    Edited by: Armin Reichert on Dec 30, 2007 7:47 PM

    Hi,
    You can add the following lines of code where-ever  you want to add the table:
        IWDTransparentContainer tr = (IWDTransparentContainer) viewObj.getElement("trans");  // Container where table will be added 
         IWDTable tab = (IWDTable) viewObj.createElement(IWDTable.class ,"Table ID");
         tr.addChild(tab);
         IWDNodeInfo nodeInfo = wdContext.nodeProducts().getNodeInfo();
         tab.bindDataSource(nodeInfo); // datasource of your table.
         // First Column
         IWDTableColumn tc1 = (IWDTableColumn) viewObj.createElement(IWDTableColumn.class, "TC1");
         IWDCaption cap1 = (IWDCaption) viewObj.createElement(IWDCaption.class,"cap1");
         cap1.setText("Column Heading 1"); // name1 of your column
         tc1.setHeader(cap1);
         IWDInputField inp1 = (IWDInputField) viewObj.createElement(IWDInputField.class,"INP1");
         tc1.setTableCellEditor(inp1);
         IWDAttributeInfo attrInfo1 = wdContext.nodeProducts().getNodeInfo().getAttribute(IPrivateTEST.IProductsElement.PRODUCT_ID);
         inp1.bindValue(attrInfo1);
         tab.addColumn(tc1);
         // Second Column
         IWDTableColumn tc2 = (IWDTableColumn) viewObj.createElement(IWDTableColumn.class, "TC2");
         IWDCaption cap2 = (IWDCaption) viewObj.createElement(IWDCaption.class,"cap2");
         cap2.setText("Column Heading 2");
         tc2.setHeader(cap2);
         IWDInputField inp2 = (IWDInputField) viewObj.createElement(IWDInputField.class,"INP2");
         tc2.setTableCellEditor(inp2);
         IWDAttributeInfo attrInfo2 = wdContext.nodeProducts().getNodeInfo().getAttribute(IPrivateTEST.IProductsElement.NAME);
         inp2.bindValue(attrInfo2);
         tab.addColumn(tc2);
         // Third Column
         IWDTableColumn tc3 = (IWDTableColumn) viewObj.createElement(IWDTableColumn.class, "TC3");
         IWDCaption cap3 = (IWDCaption) viewObj.createElement(IWDCaption.class,"cap3");
         cap3.setText("Column Heading 3");
         tc3.setHeader(cap3);
         IWDInputField inp3 = (IWDInputField) viewObj.createElement(IWDInputField.class,"INP3");
         tc3.setTableCellEditor(inp3);
         IWDAttributeInfo attrInfo3 = wdContext.nodeProducts().getNodeInfo().getAttribute(IPrivateTEST.IProductsElement.DETAILS);
         inp3.bindValue(attrInfo3);
         tab.addColumn(tc3);
    For any further doubts you can always come back to me.
    thanks & regards,
    Manoj

  • How to create a cluster on existing table

    how to create a cluster on existing table

    user8949393 wrote:
    how to create a cluster on existing tableAFAIK you can't. You have to create the cluster from scratch, something like
    --cluster key can be just one column also
    CREATE CLUSTER s_emp_dept_ic (deptno NUMBER(7), dname varchar2(30));
    CREATE TABLE emp(
      DEPTNO NUMBER(7),
      DNAME  VARCHAR2(30),
      EMPNO  NUMBER(4),
      ENAME  VARCHAR2(30)
    --cluster clause puts table in cluster.  Deptno, dname are table columns in
    --cluster key
    CLUSTER s_emp_dept_ic (deptno,dname);
    --a cluster index must be created before any data is inserted
    --the index columns used come from the cluster key from CREATE CLUSTER
    CREATE INDEX s_emp_idx ON CLUSTER s_emp_dept_ic;

  • How to insert new record into altered table

    I am using JDBC with MySQL. I altered existing table and want to insert new record using java class. But it is not possible.How to do?

    How is it "not possible"?
    Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
    Where's the problem?

  • How to insert column values into database as rows

    Hi,
    I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
    Please help me out....
    Thanks in Advance

    Lines Table:
    line_id, orcl_bank_account_num, product_type, service_type, lease_type,
    funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
    pricing_start_date, pricing_end_date, install_date, contract_end_date ,
    prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
    issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
    created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
    prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
    prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
    activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
    activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
    In this table the columns structure is :
    -- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
    -- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
    I have one more table:
    PRDCT_INS_AMT               NUMBER(14,4)
    ACTIVATION_FEE_AMT          NUMBER(14,4)
    I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
    But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations).

  • How to insert check box value in table?

    Hi all
    kindly help me how to insert check box value in database. what code i have to use as i am new in programing.
    thanx in advance

    Hi,
    There is no "Check box" in a table, a check box is a GUI (Graphical user interface) item.
    What you want is to store a boolean value in a table. For that you can use the varchar2(1) datatype and store Y or N. (or anything else)
    (you cannot define boolean as a datatype for a column).
    If you're using a front-end application like apex then it might be useful for you to read the documentation about chekc boxes :
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/check_box.htm#CHDDFBFH
    (for the rest if it's Oracle Forms then everything is already said).
    Edited by: user11268895 on Aug 17, 2010 10:44 AM

  • [CS2/CS3 JS] Inserting columns or rows in tables

    Anybody here know how to insert or add column(s)/row(s) in tables in Indesign Javascript? Please help... Thanks...

    Hi Joaquin,
    you might have to take use of the add()-command:
    Add a column before the first column:
    myTable.columns.add( LocationOptions.BEFORE, myTable.columns[0] );
    Add a row after the last row:
    myTable.rows.add( LocationOptions.AFTER, myTable.rows[-1] );
    Martin

Maybe you are looking for

  • Trouble using Creative's Live! Cam Video IM Pro

    I have just buy a new webcam and installer all that should be and upgrade.But in cam detector and Msn is my cam not with me when i move around , the pic be blurred and laggy.what can be wrong.what should i do to fix the problem?I have 2,40 GHz and 76

  • Can we set key figure in between 2 char in open hub destination.

    can any one tell me how can i insert a key description in between the char in open hub destinatio. Exp:my key description:quantity and char desc:material and plant. now i want field should be, Material. quantity plant when i am save the OHD ,i am get

  • IPad Mini Side-Switch Lock Always-Active Bug

    Hi, I have an iPad mini that behaved perfectly until around the time I upgraded to 7.0.6, when it starting making me choose between Mute or Landscape mode. If my iPad side switch is set to control the Mute option in settings, when I try to play audio

  • Download origininal .pdf form from Forms Central

    Hi, I created a new form using Forms Central, filling in the form is really easy. I sent the form to Forms Central and now i want to download and modify my original form. Is this possible? When i download the form i only get the form whitout the opti

  • ORA.01041:internal error-- IN R12

    Hi All, While testing oracle seeded reports we are getting this error. As per the error i have checked in the PL/SQL code, i found that no views are existed in the R12 which are existed in 11i. EX.. AR_CUSTOMERS_V -- existing view in Oracle 11i AR_CU