How to alter table in sql server2008

Hi Friends, I have import one table and want to alter table. How do i do this

Hi ,
YOu need Alter Command for the same. but you have to specify what you want to Alter.
For Reference
To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype
To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):
ALTER TABLE table_name
DROP COLUMN column_name
To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name
ALTER COLUMN column_name datatype
http://www.techonthenet.com/sql/tables/alter_table.php
http://www.tutorialspoint.com/sql/sql-alter-command.htm
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.

Similar Messages

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    Hi my name is vishal
    For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
    Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using System.Diagnostics;
    using System.IO;
    namespace DRRS_CSharp
    public partial class frmPDF : Form
    public frmPDF()
    InitializeComponent();
    private void button1_Click(object sender, EventArgs e)
    Document doc = new Document(PageSize.A4.Rotate());
    var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(6);
    table.TotalWidth =530f;
    table.LockedWidth = true;
    PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
    cell.Colspan = 6;
    cell.HorizontalAlignment = 0;
    table.AddCell(cell);
    Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
    para.Alignment = Element.ALIGN_CENTER;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(105f, 105f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("Reprocessing Date");
    table.AddCell("Patient Name");
    table.AddCell("Dialyzer(Manufacturer,Size)");
    table.AddCell("No.of Reuse");
    table.AddCell("Verification");
    table.AddCell("DialyzerID");
    while (dr.Read())
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
    table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
    table.AddCell("@count".ToString());
    table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
    table.AddCell(dr[0].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(table);
    doc.Close();
    System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
    if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
    var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
    this.Close();
    The above code executes well with no problem at all!
    As you can see the file to which i create and save and open my pdf report is
    AssignedDialyzer.pdf.
    The column headers of table in pdf report from c# windows forms using iTextSharp are
    "Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
    "DialyzerID".
    However the problem i am facing is after execution and opening of document is my
    column headers in table in pdf report from
    c# and datas in it all appear in bold.
    I have browsed through net regarding to solve this problem but with no success.
    What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
    Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
    I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
    Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
    If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
    vb6,adodb with ms access using iTextSharp?
    I have approached Sound Forge.Net for help but with no success.
    I hope anyone/someone truly understands what i am trying to ask!
    I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
    Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
    I hope i get a reply in terms of solving this problem.
    vishal

    Hi,
    About iTextSharp component issue , I think this case is off-topic in here.
    I suggest you consulting to compenent provider.
    http://sourceforge.net/projects/itextsharp/
    Regards,
    Marvin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I use the SQL to create a primary key for a existing table?

    create table a(bm number,mc varchar2(20));
    when the table was created,i want to make the column bm as
    the primary key and my SQL is "alter table a enable primary key bm",the system show
    me error,how can I write the right one?

    create table a(bm number,mc varchar2(20));
    when the table was created,i want to make the column bm as
    the primary key and my SQL is "alter table a enable primary key bm",the system show
    me error,how can I write the right one? You do not have any primary key defined on your table yet, so, it does not make sense to enable it (if at all possible) !
    You need to add PRIMARY KEY using something like this:
    SQL> alter table a add constraint pk_a_bm primary key (bm) ;

  • DB Tool List Table: How to access tables which are in different SQL database ?

    Hi, All,
    I'm working on a database application (SQL server) and is evaluating the NI DB Tool kit for this project.
    One of the requirement is that I need to access tables which are in two different database
    (say Table A in DB 1 and Table B in DB 2).
    Our IT guys has linked Table A in DB1 to DB 2 and I verfied this when I use the SQL server managment studio.
    When DB 2 tables are populated, Table A from DB1 is also there. I can also do the same thing using MS Access.
    Table A in DB1 is avalaible to me enven though I only connect to DB 2.
    Here comes the problem.
    When I use DB Tool List Table.vi to access DB2, it does NOT list Table A in DB1. It only list the tables in
    the database (DB2) which I make connection to (using DB Tool Open Connection.vi with a file DSN)
    So my work around right now is to open two seperate connection to DB1 and DB2. However, this approach
    obviously creates a problem when I have to access seperate database constantly in my application.
    What would be a solution to this ? I've search the forum but only see one post that's somewhat related to
    my question. (And it was posted on 2004) Perhaps I need to alter the code in the orignial VI (DB Tool List Table.vi)??
    My IT guy told me he has not encountered this scenario since he writes codes in other enviroment such as
    VB and others, and he's always been successful by linking tables to different database. 
    I hope my question is sound and clear since I really don't know much about database terminology.
    Any comment/suggestion is much appreciated !!!
    Thanks
    Chad
    Solved!
    Go to Solution.

    To josborne:
    To answer your question:
    - Are the two databases contained on the same SQL Server instance? 
    Or are the databases on separate instances?  I assume they are on
    separate servers, otherwise this wouldn't really be an issue.  But its
    good to know because it will affect how you build your SQL statements.
    Yes they are on separate instances. 
    - Ask your IT people specifically how they "linked Table A in DB1 to
    DB 2".  I assume they used "linked servers". 
    Maybe I used the wrong terminology "linked." They created a "View of Table A (DB1)" in DB2 using the management studio.
    Here is a screen shot of that. As you can see, dbo.VISUAL_WORK_ORDER is seen under LABVIEW database in the management studio.
    I also see the same table when I make connection to database using MS Access.
    Could you elaborate on "configure your SQL statement correctly" =) ? The purpose of using LabView's took kit is so that I can do
    minimum SQL statements. Are you talking about modifying LabView's native VI (DB Tool List Table.vi) ?
    Thanks for the information. SQL is just something new to me.

  • Sql: how to alter a type of a filed

    Hi all,
    Quick question, how can I change a type of a field with a sql statment.
    I have my username set to varchar(50) and i want to expend it to (300);
    thanks
    peter

    If you can do it in your database, it will likely be with SQL like:
    ALTER TABLE table_name MODIFY username VARCHAR2(300)The syntax and limitations vary from database to database and version to version; in some versions of Oracle, you can increase the size of a VARCHAR2 but not decrease it. In MySQL, such an alteration is made by copying the entire table to a temporary table and back again, which is slow for large tables.
    You should find a SQL reference for your database.
    MySQL
    http://dev.mysql.com/doc/mysql/en/alter-table.html
    Oracle
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3001.htm#sthref3982

  • ALTER TABLE in Hypersonic SQL

    As we all know, Hypersonic SQL does not support the ALTER TABLE statement
    yet, so the cool schema update feature of the schematool does not work.
    However, it seems like it would be possible to achieve the same effect
    with the following sequence of SQL statements (yes, I know it would be
    really slow!):
    1. Create a new temp table with all the columns of the original table plus
    the new column(s).
    2. SELECT INTO from the original table into the temp table.
    3. Drop the original table.
    4. Create a new table with the same name as the original table with all
    the desired columns.
    5. SELECT INTO from the temp table to the new table.
    6. Drop the temp table.
    Is there any way in a HSQLDictionary subclass to alter the generation of
    the ALTER TABLE statements?
    Thanks,
    David A. King

    Thanks for your help on this.
    I just tried the following set of SQL statements to simulate an ALTER
    TABLE:
    // This is the original table
    CREATE TABLE T1 (A VARCHAR PRIMARY KEY, B VARCHAR, C VARCHAR)
    // Here are the statements to do an ALTER TABLE
    SELECT * INTO T2 FROM T1
    DROP TABLE T1
    CREATE TABLE T1 (A VARCHAR PRIMARY KEY, B VARCHAR, C VARCHAR, D VARCHAR)
    INSERT INTO T1 (A, B, C) SELECT A, B, C FROM T2
    DROP TABLE T2
    These statements work. What is needed to produce them is the original set
    of column names (and definitions), in this example (A VARCHAR PRIMARY KEY,
    B VARCHAR, C VARCHAR); and the new column definition, in this example (D
    VARCHAR).
    Thanks,
    David
    Marc Prud'hommeaux wrote:
    David-
    A quick test shows that this isn't going to be quite so easy: 'SELECT
    INTO' requires that the table name be a new table, not an already
    existing one. And 'INSERT INTO TABLE_A SELECT * FROM TABLE_B' will fail
    if there are a different number of columns. Thus, the API would require
    some additional metadata (about how many columns exist in the current
    table) in order to be able to do this.
    I have made a note of it in the RFE that I made for this.
    Marc Prud'hommeaux <[email protected]> wrote:
    David-
    Interesting idea: we will look into doing that for the future. It would
    be very nice if we could support schema migration on Hypersonic, since
    it is very lightweight and flexible. I have made an enhancement request
    at:
    https://bugzilla.solarmetric.com/show_bug.cgi?id=160
    If you want to give it a shot yourself, you can extends the
    com.solarmetric.kodo.impl.jdbc.schema.dict.HSQLDictionary class and
    override:
    public String[] getAddColumnSQL (Column column)
    and
    public String[] getDropColumnSQL (Column column)
    The methods should return an array of SQL statements that should be
    executed to perform the add or drop.
    David A. King <[email protected]> wrote:
    As we all know, Hypersonic SQL does not support the ALTER TABLE statement
    yet, so the cool schema update feature of the schematool does not work.
    However, it seems like it would be possible to achieve the same effect
    with the following sequence of SQL statements (yes, I know it would be
    really slow!):
    1. Create a new temp table with all the columns of the original table plus
    the new column(s).
    2. SELECT INTO from the original table into the temp table.
    3. Drop the original table.
    4. Create a new table with the same name as the original table with all
    the desired columns.
    5. SELECT INTO from the temp table to the new table.
    6. Drop the temp table.
    Is there any way in a HSQLDictionary subclass to alter the generation of
    the ALTER TABLE statements?
    Thanks,
    David A. King
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code

  • SAP HANA - How to run alter table statement in HANA procedure?

    I am trying to run alter table statement in a procedure. HANA gives error saying
    SAP DBTech JDBC: [257] (at 1338): sql syntax error: ALTER TABLE is not allowed in SQLScript: line 36 col 8 (at pos 1338)
    How to run alter table statements in procedure?
    Thanks,
    Suren.

    Hi Rich Heilman,
    Thanks for your response.  I have tried with dynamic SQL. I am trying to add partitions to a non portioned table.
    EXECUTE IMMEDIATE 'ALTER TABLE ' || :SCHEMA_NAME || '.TARGET_TABLE PARTITION BY RANGE (TARGET_TYPE_ID) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION VALUE = 4, PARTITION OTHERS)';
    Execution fails with error
    Could not execute 'CALL PARTITION_TARGET_TABLE('SUREN_TEST')' in 1.160 seconds .
    [129]: transaction rolled back by an internal error:  [129] "SUREN_TEST"."PARTITION_TARGET_TABLE": line 53 col 3 (at pos 2173): [129] (range 3)
    Any reasons for this error?
    Thanks,
    Suren.

  • How can we find the most usage and lowest usage of table in Sql Server by T-SQL

    how can we find the most usage and lowest usage of table in Sql Server by T-SQL
    The table has time stamp column
    StartedOn datetime
    EndedOn datetime

    The Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
    SELECT
    FROM
    databasename,
    duration
    fn_trace_gettable('F:\Program
    Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
    default)
    WHERE
    DATABASENAME='ZTCFUTURE'
    AND TEXTDATA
    IS
    NOT
    NULL
    --AND TEXTDATA LIKE 'SERVICE%'
    order
    by cpu
    desc; 

  • How to Create a Temporary Table with SQL Server

    I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
    I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs.  Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
    I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets.  Employees who are no longer employed, don't match, and don't display.  Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server.  Preferably in a temporary table.
    I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
    I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
    This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options.  That starts the queries, which creates the report.  So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
    If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source.  I'm trying the following, but getting an error:
    <CFQUERY name="ITE_Temp" datasource="SkynetSQL">
    CREATE TABLE #MyTemp
    (   INSERT INTO #MyTemp
    ITE2.TrueFile char (7) NOT NULL,
    ITE2.CountOfEmployee int NULL,
    ITE2.DTL_SUBTOT decimal NULL,
    ITE2.EMPTYPE char (3) NULL,
    ITE2.ARPT_CD char (3) NULL
    </CFQUERY>
    So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table.  I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
    <CFQUERY datasource="SkynetSQL">
    <CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
    INSERT INTO ITE_Temp
       (FullFile,
       EmployeeCount,
       DTL_Amount,
       EmployeeType,
       station)
    VALUES  ('#ITE2.TrueFile[i]#',
       #ITE2.CountOfEmployee[i]#,
       #ITE2.DTL_SUBTOT[i]#,
       '#ITE2.EMPTYPE[i]#',
       '#ITE2.ARPT_CD[i]#')
    </CFLOOP>
    </CFQUERY>
    But, I hate to have to create a table and physically write to it.  For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct?  Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE?   If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
    Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server.  Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer).  Thanks for any advice/help.  Much appreciated.
    Gary

    While waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work.  That was with this syntax:
    <CFQUERY name="AddTableRecords" datasource="MyTable">
    TRUNCATE TABLE ITE_Temp
    <CFOUTPUT query="ITE2">
    INSERT INTO ITE_Temp
    (FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
    VALUES
    ('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
    </CFOUTPUT>
    </CFQUERY>
    However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table.  But when I tried to read and output the results from the temp table, I got an error.  Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax.  Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
    <CFQUERY name="ITE_Temp2" datasource="MyTable">
    DROP TABLE ##MyTemp2
    CREATE TABLE ##MyTemp2
    FullFile char (7) NOT NULL,
    EmployeeCount int NULL,
    DTL_Amount decimal NULL,
    EmployeeType char (3) NULL,
    station char (3) NULL
    <CFOUTPUT query="ITE2">
    INSERT INTO ##MyTemp2 VALUES
    '#ITE2.TrueFile#',
    #ITE2.CountOfEmployee#,
    #ITE2.DTL_SUBTOT#,
    '#ITE2.EMPTYPE#',
    '#ITE2.ARPT_CD#'
    </CFOUTPUT>
    </CFQUERY>
    So even though the above works, I could use some help in reading/writing the output.  I've tried several things similar to below, but they don't work.  It't telling me ITE_Temp2 does not exist.  It's not easy to find good examples of creating temporary tables in SQL Server.
    <CFQUERY name="QueryTest2" datasource="SkynetSQL">
    SELECT *
    FROM ITE_Temp2
    </CFQUERY>
    <CFOUTPUT query="ITE_Temp2">
    Output from Temp Table<br>
    <p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
    </CFOUTPUT>
    Thanks for any help/advice.
    Gary.

  • How to extract data from multiple flat files to load into corresponding tables in SQL Server 2008 R2 ?

    Hi,
              I have to implement the following scenario in SSIS but don't know how to do since I never worked with SSIS before. Please help me.
              I have 20 different text files in a single folder and 20 different tables corresponding to each text file in SQL Server 2008 R2 Database. I need to extract the data from each text file and
    load the data into corresponding table in Sql Server Database. Please guide me in how many ways I can do this and which is the best way to implement this job.  Actually I have to automate this job. Few files are in same format(with same column names
    and datatypes) where others are not.
    1. Do I need to create 20 different projects ?
                   or
        Can I implement this in only one project by having 20 packages?
                 or
        Can I do this in one project with only one package?
    Thanks in advance.

    As I said I don't know how to use object data type, I just given a shot as below. I know the following code has errors can you please correct it for me.
    Public
    Sub Main()
    ' Add your code here 
    Dim f1
    As FileStream
    Dim s1
    As StreamReader
    Dim date1
    As
    Object
    Dim rline
    As
    String
    Dim Filelist(1)
    As
    String
    Dim FileName
    As
    String
    Dim i
    As
    Integer
    i = 1
    date1 =
    Filelist(0) =
    "XYZ"
    Filelist(1) =
    "123"
    For
    Each FileName
    In Filelist
    f1 = File.OpenRead(FileName)
    s1 = File.OpenText(FileName)
    rline = s1.ReadLine
    While
    Not rline
    Is
    Nothing
    If Left(rline, 4) =
    "DATE"
    Then
    date1 (i)= Mid(rline, 7, 8)
     i = i + 1
    Exit
    While
    End
    If
    rline = s1.ReadLine
    End
    While
    Next
    Dts.Variables(
    "date").Value = date1(1)
    Dts.Variables(
    "date1").Value = date1(2)
    Dts.TaskResult = ScriptResults.Success
    End
    Sub

  • How to use create-default-dbms-tables in SQL Server 2000

    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1 SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

    Refer to
    http://e-docs.bea.com/wls/docs81/ejb/DDreference-cmp-jar.html#1162249
    "Keith" <[email protected]> wrote:
    >
    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1
    SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the
    CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create
    the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

  • How to change default value in a table using ALTER TABLE

    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    Any help will be needful for me
    Thanks and Regards

    user598986 wrote:
    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    ALTER TABLE  test
    MODIFY (indicator DEFAULT 'I'); 
    Incidentally, INDICATOR is a keyword in Oracle, so you may have problems using it as a column name. If so, you'll have to enclose the column name in double-quotes, and be careful to use capital letters inside the quotes.
    Edited by: Frank Kulash on Aug 26, 2009 11:42 AM

  • How to process each records in the derived table which i created using cte table using sql server

    I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
    how to process each records in the derived table which i created using  cte table using sql server

    Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How can I load data into table with SQL*LOADER

    how can I load data into table with SQL*LOADER
    when column data length more than 255 bytes?
    when column exceed 255 ,data can not be insert into table by SQL*LOADER
    CREATE TABLE A (
    A VARCHAR2 ( 10 ) ,
    B VARCHAR2 ( 10 ) ,
    C VARCHAR2 ( 10 ) ,
    E VARCHAR2 ( 2000 ) );
    control file:
    load data
    append into table A
    fields terminated by X'09'
    (A , B , C , E )
    SQL*LOADER command:
    sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
    datafile:
    column E is more than 255bytes
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)

    Check this out.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961

  • How do I add more than one column to a table using SQL?

    Hi
    I need to add 3 columns to a table using SQL
    the syntax
    "ALTER TABLE TEST ADD COLUMN newcol1 float";
    works fine - for adding one coumn only.
    For multiple columns I tried various permutations along the lines of
    "ALTER TABLE TEST ADD (COLUMN newcol01 float, COLUMN new2 float,COLUMN new3 float)";
    "ALTER TABLE TIPSTEST ADD COLUMN new1 float"
    "ALTER TABLE TIPSTEST ADD COLUMN new2 float"
    "ALTER TABLE TIPSTEST ADD COLUMN new3 float"
    etc., but this doesn't work.
    From a web search it sounds like SQL can only add one column at a time.
    I have a workaround : create intermediate temporary tables , copying data and adding
    one column at each stage. It seems a fairly awkward way of programming though.
    Am I missing something simple : is there a way to add multiple columns in one go?
    Thanks

    OK : solved an underlying problem with this one myself
    for the code
    String createString;
    createString =  "select COFFEES.* INTO NEWCOFFEES FROM COFFEES"; // example
              Statement stmt;
              try {
                   stmt = a_Globals.database1Connection.createStatement();
                          stmt.executeUpdate(createString);
                   stmt.close();
                   a_Globals.database1Connection.close();
              } catch(SQLException ex) {
                   System.err.println("SQLException: " + ex.getMessage());
              }                    commenting out the line:
    a_Globals.database1Connection.close();
    Allowed the subsequent SQL statement(s) to work OK. Looks like this was the cause of several
    difficulties, preventing me doing several SQL instructions in turn.
    Thanks for the responses.
    Mike2z

Maybe you are looking for

  • Won't Open Any Documents

    Hi all, I'm pretty new to Illustrator and I'm currently using Illustrator CS6 v16.0.0 x32 on Windows 7. I'm having an issue where it's not letting me open any documents or basically use it... hence the long description: When I load the program, every

  • Images in JFrame

    Hi. I need to put an image over a JFrame, I browse a lot of sites but I did not found anything useful. Someone know how to do this? Regards.

  • Can't open Safari because it is not supported on this type of Mac

    mac OS X mavericks was a sleep and now can not open Safari, gives message: You can't open the application Safari because it is not supported on this type of Mac. How can I get the Safari working again?

  • W520 won't start: on/off button just flashes

    Help! Can't turn on w520. Power button flashes with 1s intervals From power off, when press then round on/off button, the following happens: 1) power button starts flashing 2) DVD drive makes its startup noise. 3) power button continues flashing. At

  • Difference Between SE09 and SE10

    What is the Difference Between SE09 and SE10?