INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

Hi All,
I have to insert the data into a SQL SERVER 2005 Database table.
I am able to insert the data into a normal SQL Server table.
When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
Had anybody tried this??
There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
Thanks
V Kumar

Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
I had followed that note, but still it is not working for me.
But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
Thanks
V Kumar

Similar Messages

  • Problem inserting date into MS SQL Server

    I am trying insert date into MS SQL Server database. First I used Statement and when I insert the date only date used to be inserted properly and the time used to be always 12:00:00 AM. I tried PreparedStatement and when I insert I get an error message:
    SQL Error: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    I have attached the code.
    GregorianCalendar cal = new GregorianCalendar();
    java.util.Date dtm = (java.util.Date)cal.getTime();
    SimpleDateFormat formatOb = new SimpleDateFormat("dd/MM/yy hh:mm:ss");
    String date= (String)formatOb.format(dtm);
    dateCreated = new java.sql.Date(formatOb.parse(date).getTime());
    PreparedStatement psmt = con.prepareStatement("INSERT INTO Resume (ResumeName, Summary, Skills, OtherInformation, Interests, Memberships, Languages, Category, DateCreated, SupervisorName) VALUES(?,?,?,?,?,?,?,?,?,?)");
    psmt.setString(1, name);
    psmt.setString(2, summary);
    psmt.setString(3, skills);
    psmt.setString(4, info);
    psmt.setString(5, interest);
    psmt.setString(6, member);
    psmt.setString(7, language);
    psmt.setString(8, category);
    psmt.setDate(9, dateCreated);
    psmt.setString(10, loginName);
    psmt.executeUpdate();
    Any suggestions will be really helpful.

    Thanks,
    I changed the field in the database of DateCreated to timestamp, but when I insert the some binary data is inserted into the database. something like 0000000000000017D.
    I installed jtds-0.8.1 driver from source forge. but when try to connect to the database I get an error as:
    Connection refused: connect
    Error: Connection refused: connect
    I have attached the code for setting the driver and url also.
    private String driver = "net.sourceforge.jtds.jdbc.Driver";
    private String url = "jdbc:jtds:sqlserver://TEKKATTE:1433/placement;TDS=7.0";

  • Inserting data into MS SQL server 2000/2005 - JEE application

    Hello everyone,
    Looking at the Tutorial, roster, under ejb, it uses EntityManager and persistence to insert and access data from the, what i presume the Java DB. So i tried it with my applications. I get no errors when I insert the data. Only that it is not going into the DB, which is an external database, MS SQL server. Does this mean I can only insert and access data from the database through sql statements?
    Help!
    Thanks
    eve

    Hello everyone,
    I have made progress on this. And if anyone requires more details check this website:
    http://www.webagesolutions.com/knowledgebase/javakb/jkb006/index.html
    Also please check your firewalls when dealing with external DB. For example, the windows firewall blocks the server from access MS server DB. So in an actual of fact, my above problem was working, only that it was probably directing data to the Java DB included in the application server 9.
    The progress so far, is good. The persistence xml seems to create the Tables into the database. But it does not enter data into the database. Below is the error I get:
    java.lang.ClassCastException: com.sun.gjc.spi.DataSource
    at productinfor.AppClientMachines$saveListener.actionPerformed(AppClientMachines.java:138)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:5501)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5266)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3968)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1778)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Aslo the error is point to this in my client:
    Machinesbean sebean=(Machinesbean)ctx.lookup("jdbc/ProductDetailsDB");
    And below is the xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="PRODUCTINFOR-ejbPU" transaction-type="JTA">
    <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
    <jta-data-source>jdbc/ProductDetailsDB</jta-data-source>
    <properties>
    <property name="toplink.ddl-generation" value="create-tables"/>
    </properties>
    </persistence-unit>
    </persistence>
    Somebody also suggestion I make my persistence xml file as follows to use MS server 2000/2005:
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name="PRODUCTDETAILS3-ejbPU">
    <jta-data-source>jdbc/ProductDetailsDB</jta-data-source>
    <properties>
    <!--Use the java2db feature -->
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    <!-- Generate the sql specific to MS SQL database -->
    <property name="toplink.platform.class.name"
    value="oracle.toplink.essentials.platform.database.SQLServerPlatform"/>
    </properties>
    </persistence-unit>
    </persistence>
    Any suggestions will help. If not I hope this helps somebody else. Thanks for all your help
    eve
    Message was edited by:
    evepokua

  • How to insert chinese data into MS SQL Server 2000 through JDBC

    I am trying to insert chinese data into MS SQL server 2000 using JDBC. how to do this?
    can anybody help me.
    thanx.

    I am trying to insert chinese data into MS SQL server 2000 using JDBC. how to do this?
    can anybody help me.
    thanx.

  • *Urgent*How to insert data from MS SQL to the table that create at the adobe form?

    Hi,
    I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
    I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
    Thanks

    Tou need to do a couple of things
    1. On the Essbase server, set up an odbc system connection to your MySQL database
    2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
    The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it

  • Migration from sql server 2005 tables to oracle tables.

    Hi,
    Kindly give the steps to migrate from sql server 2005 tables to oracle tables.
    Kindly advise
    Oracle database version:
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE 10.2.0.1.0 Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Edited by: 873127 on Jul 18, 2011 9:46 PM

    Are you migrating or taking continual updates?
    If migrating it might be worth considering The SQLDeveloper Migration Workbench (which moves more than just data)..
    http://www.oracle.com/technetwork/database/migration/sqldevmigrationworkbench-132899.pdf
    Cheers
    David

  • Storing the file in to the sql server 2005 table

    hi,every body...
    in my appliaction i need to store the files.
    i have searched the net but only i found as BLOB(Binary L:arge OBject) is the solution,
    how to use this blob...technique..
    can any one send some sample of code to explain.......
    how to insert a file and how to retrive the inserted file from the SQL SERVER 2005...
    thanks in advance..

    yes, ur rite thse two methods are available..
    but i didnt understand that..the method setBinaryStream() accepts 3 parameters
    the last parameter which i know that.. size of the file of int type rite?
    can u give some more information regarding this..
    thanks ..

  • Insert to XE from sql server 2005 ...

    Hi,
    is it possible to create a trigger on Sql Server 2005 to insert a row to Oracle XE ?
    I want to create a update/insert trigger on sql server 2005 which will insert the data into a Oracle XE table.
    I have a Linked Servers in Sql Server to Oracle XE and this link works with simple sql statement from sql server like :
    INSERT INTO [NEW_OR]..[Adam_user].[DUMMY] (AA) VALUES('Dummy String Data')
    But the same statement does not work when in trigger. the following error occurs in Sql Server 2005...
    Msg 8501, Level 16, State 3, Procedure deneme, Line 5
    MSDTC on server 'Adam_user' is unavailable.
    Any suggestions?
    Thanks in advance.....
    Adam

    Here is the answer...
    May be useful for someone who needs the same solution ...
    The Distributed Transaction Coordinator service must be start on windows to accomplish the transaction ...
    For this:
    (on windows)
    START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Find the service called 'Distributed Transaction Coordinator' and RIGHT CLICK (on it and select) > Start.

  • Automating Data Migration from SQL Server 2005

    Hi All,
    I need to migrate data from SQL Server 2005 to Oracle DB ( Datawarehouse). The data migration involves updating Dimensions and Fact table. I have got painful job of switching topology to point to over 100 different weekly SQL DBs ( in sequence) and pull the data into DW. How can I automate my ODI process to switch from one after the other.
    Any Ideas?
    KS

    ODI Variables are there to help you with this. Please go through this post at [http://blogs.oracle.com/dataintegration/2009/05/using_odi_variables_in_topolog.html] .
    This will show you how to use a variable Oracle data server.
    On similar lines you should be able to switch to any of your 100 weekly SQL server DBs.
    And loop in a sequence to load data from all of them.
    Hope that helps

  • Update data automatically in sql server 2005 based on condition proplem

    Hi guys i have problem I have two table
    First one is
    Second One is Vacation
    as relation one to many (vacation has foreign key of Contract No OF Table Contract) 
    what i need is to update Contract table with field status =Finish where start vacation date >end contract Date
    How i do that in sql server 2005 to make update automatically
    Ex
    contract table
    status             nvarchar(20)
    end contract    date time
    vacation table
    start vacation date time
    end vacation date time
    start vacation date is 23/10/2014
    and End
    is 26/10/2014
    Now not update status in contract table to finish because vacation date start is less from end contract
    but when date today is 27/10/2014 update contract table field status to finish
    automatically with sql server 2005 
    How i do that condition to make update to data automatically based on changing on date
    Update statement i need is 
    update Contract set status = finish where start vacation>end contract
    but problem how i write this statement to update data automatically based on date today

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. You failed again. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Now we have to write the DDL that you did not bother with! What you did post was wrong! There is no key or constraints. There is no generic “status” in RDBMS; a "<something in particular>_status"
    is a state of being, so it needs a temporal duration. The correct idiom for this data model is: 
    CREATE TABLE Vacations
    (vacation_contract CHAR(15) NOT NULL PRIMARY KEY,
     vacation_start_date DATE NOT NULL,
     vacation_end_date DATE,
     CHECK(vacation_start_date < vacation_end_date),
    Oh, a field is nothing like a column. You need to read a basic SQL or RDBMS book; you do not know the basics. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Cannot set up data source for SQL Server 2005

    Is it possible to use Microsoft's Beta 2 version of the SQL Server 2005 JDBC driver with WebLogic 9.0? I've downloaded the driver and added it to my server classpath, but when I try to create a new data source using the admin console, the drop-down list for Microsoft SQL Server only contains drivers for the 2000 version. If I select "Other" from the list and try to move on, I get a cryptic, page-long error on the admin console. If I just select the 2000 driver and try to manually modify the parameters on the next set of screens, I still get errors when I try to test the configuration. I've successfully used a third-party driver before, but this one does not seem to be working. Any help would be greatly appreciated.
    Regards,
    Sabrina

    SabrinaL wrote:
    Is it possible to use Microsoft's Beta 2 version of the SQL Server 2005 JDBC driver with WebLogic 9.0? I've downloaded the driver and added it to my server classpath, but when I try to create a new data source using the admin console, the drop-down list for Microsoft SQL Server only contains drivers for the 2000 version. If I select "Other" from the list and try to move on, I get a cryptic, page-long error on the admin console. If I just select the 2000 driver and try to manually modify the parameters
    on the next set of screens, I still get errors when I try to test the configuration. I've successfully used a third-party driver before, but this one does not seem to be working. Any help would be greatly appreciated.
    Regards,
    SabrinaHere I describe the steps I took to bypass the console in making a new pool.
    1 - Edit the script %DOMAIN_HOME%\bin\startWebLogic.cmd to add a line like this:
    set CLASSPATH=%CLASSPATH%;\new_ms_driver\beta2\sqljdbc_1.0\enu\sqljdbc.jar
    In other words, you have to explicitly add a third party driver's classes to
    the CLASSPATH that will be in effect for the server. Just adding the driver
    to your window's class path will do nothing.
    2 - Go to the directory %DOMAIN_HOME%\config\jdbc, where you will find
    files of the name *-jdbc.xml. Each of these represents a DataSource.
    Copy one of them, perhaps either examples-demo-jdbc.xml, or
    examples-demoXA-jdbc.xml depending on whether you want to make an XA
    or non-XA pool. Make you new file's name like the name of the DataSource,
    still ending in -jdbc.xml. Eg: MS_Beta-jdbc.xml
    3 - Edit this file to change as much as would be clear for the
    driver you want. Eg: change the driver class to the class you want,
    the user name, URL, test table etc. Also, change the pool's initial
    capacity to 0. This is so the pool can be created without making a
    connection. We need that because the password is encrypted, and
    there is no manual way for you to add the correct one yet.
    4 - go one directory up, and edit the config.xml. Find a
    jdbc-system-resource entry corresponding to the original
    resource file you copied. Make a new entry in the config file,
    like the original, but change the Datasource name to your new one.
    5 - If this all went well, reboot your server and go to your data
    source in the console, and edit it. Alter the password to what it
    really should be, and you can also change whatever else you might
    want.
    6 - shut down again, and reboot, and you should then be able to go to
    your data source in the console and test a connection.
    That's it. Here is an example of a jdbc.xml file I made, and
    the entry I made in the config.xml:
    config/jdbc/newpool-jdbc.xml:
    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/domain.xsd">
    <name>newpool</name>
    <jdbc-driver-params>
    <url>jdbc:sqlserver://frogger:1433</url>
    <driver-name>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-name>
    <properties>
    <property>
    <name>user</name>
    <value>joe</value>
    </property>
    </properties>
    <password-encrypted>{3DES}cPpx2Z6faqY=</password-encrypted>
    </jdbc-driver-params>
    <jdbc-connection-pool-params>
    <initial-capacity>1</initial-capacity>
    <max-capacity>5</max-capacity>
    <capacity-increment>1</capacity-increment>
    <shrink-frequency-seconds>900</shrink-frequency-seconds>
    <test-connections-on-reserve>true</test-connections-on-reserve>
    <test-table-name>SQL select 1</test-table-name>
    <profile-type>0</profile-type>
    </jdbc-connection-pool-params>
    <jdbc-data-source-params>
    <jndi-name>newpool</jndi-name>
    <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>
    </jdbc-data-source-params>
    <jdbc-xa-params></jdbc-xa-params>
    </jdbc-data-source>
    config.xml entry:
    <jdbc-system-resource>
    <name>newpool</name>
    <target>examplesServer</target>
    <descriptor-file-name>jdbc/newpool-jdbc.xml</descriptor-file-name>
    </jdbc-system-resource>

  • Error in adding PRIMARY Data file of SQL Server 2005

    Hi Experts,
    I am using SQL 2005 as back end database for SAP ECC6. Due to Space problem in PRD data volume, i have added PRDDATA4.ndf file in SSMS ( SQL Server Management Studio) and saved. But, suddenly i got one more idea and extended the file size of exisiting PRDDATA1.mdf, PRDDATA2.ndf & PRDDATA3.ndf immediately i removed the PRDDATA4.ndf file before starting the service. But, while seeing in SAP using ST04 it showing the PRDDATA4.ndf with error message of file missing. What i have to do now? How can i delete the information showing in ST04. But it is not showing in SSMS.
    Please help how to solve this.
    Regards,
    B.Sudharsan

    Hi,
    Following solution might help you to resolve the issue.
    Solution1:
    Issue happens because universe connection to the Database is not responding and the Data Source Name is not configured to write SQL Server 2005 database.
    Resolution
    Created new DSN connection under SYSTEM DSN to SQL Server 2005 Database.
    Import the universe from the designer.
    Go to File->Parameters.
    Edit Connection.
    On the Database Middleware Page expand SQl Server 2005->Select SQL Server 2005 driver.
    Change the DSN to new DSN connection
    Test the connection.
    Save the Universe and Export it to the repository.
    Solution2:
    I am taking Oracle as an example over here.
    This can be caused when the SQLNET.ora is located in a remote location using mapped drives.
    Resolution
    To resolve,
    check the registry [HKLM\SOFTWARE\ORACLE] you should see a folder called HOME0
    look for any paths that contain a mapped drive partition
    Change the mapped drive letter to a UNC path (
    server\folder)
    Open a command prompt and do a tnsping using the tnsname and verify the location of the SQLNET.ora or TNSNAMES.ora
    If the path is not updated to the new path
    Reboot the server
    Regards,
    Sarbhjeet Kaur

  • Upgrade data base from sql server 2005 to sql server2008

    Hi guys,
    What is the best way for upgrade my SQL Server 2005 data base to SQL 2008?

    It depends on how you want migrate, in-place or side-by-side?
    In-place: Run a backup of all databases and then install the new SQL Server version
    Side-by-side: Install the new SQL Server, backup all database of old SQL Server and restore them on the new one. Then copy all logins from old to new server.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Using VBA from Excel, how to send datas into a SQL server

    Hi,
    How do you use VBA to provide the connection to insert datas into a table within a database.
    What kind of statements do we need. 
    The database, and table are for example already created.
    Thanks

    Hi
    I know this is an old thread but did you come right?

  • Best way to insert data into a non indexed partitioned table?

    Hi,
    I've a rather basic question that I haven't been able to find an answer to so hope that someone may be able to help.
    We need to insert sales data into a partitioned table that is range partitioned on sales date. The incoming sales data can span a number of days, e.g. 31-JUL-2007 through to 04-AUG-2007 inclusive. I've come up with two approaches and would like to know which you would recommend and why?
    Approach 1: Load data into each individual partition using a statement like:
    INSERT /*+ APPEND */ INTO sales PARTITION (sales_20070731) SELECT * FROM sales_new WHERE sales_date = TO_DATE('31-AUG-2007','DD-MON-YYYY')
    Approach 2: Load data into the entire table using a statement like:
    INSERT /*+ APPEND */ INTO sales SELECT * FROM sales_new
    Thanks

    You need to compare both approaches by creating simple test case.
    But there is no advantages in approach 1until you will have index on sales_date column.
    With index these approaches are comparable and you can choose whatever best fits to your requirements.
    Best Regards,
    Alex

Maybe you are looking for

  • Closed Screen, External Monitor, Heat, and Fans

    We have our MBP connected to an external Dell Ultra 22" dvi monitor (awesome!). We use apple BT keyboard and mighty mouse (again awesome!). Now, my concerns: 1. Screen damage from keyboard - I've read (to my disbelief) that mac laptop/portable machin

  • How to Map the Categorization Reasons(SAP CRM) with Order Reasons(SD  ECC )

    Hi Team . I have created a service order for a spare parts material in CRM Web ui , order got saved successfully without errors and had replicated to ECC system. Issue : When the user is processing billing in ECC , the system is asking for the order

  • How to always Allow Flash Player by Default??????????

    So I'm using the original 10.3 version of flash, which is really the only stable version of flash that I can use without any problems here on Firefox. Unfortunately, the newest version of firefox blocks that plugin on every site that I go to, and I h

  • Not able to start opmn

    hi , AS 10.1.3.4 we have stopped opmn to apply some ssl certificates, after doing that we tried restarting the opmn. but it is giving error. we tried starting it after reverting the change also....but no luck. it gives below logs: <2010-12-06 19:21:2

  • How do i troubleshoot sharing outside my home network?

    I have four Macs - iMac20, iMac27, Mac Mini and a MacBookPro. I have no trouble connecting and sharing data and screens between these machines when I'm at home on my home network, but when I'm at work and I want to connect from my MacBook Pro to my M