What is Oracle's alternative to IDENTITY Column in SQL Server/ DB2

What is Oracle's alternative to IDENTITY Column(Auto Increment Column) in SQL Server/ DB2 ? Is Sequence and Trigger the only way out for this?
Why is Oracle not creating anything like an Identitiy column in SQL Server?

What is Oracle's alternative to IDENTITY Column(Auto
Increment Column) in SQL Server/ DB2 ? Is Sequence
and Trigger the only way out for this?Of course not, you can use in your inserts sequences as well:
insert into blahh values (my_seq.nextval, ...) and use returniong clause to get the value back if necessary
You can use them in insert with subselects
insert into blah
select my_seq.nextval, ...
from ....
>
Why is Oracle not creating anything like an Identitiy
column in SQL Server?Because they are different companies with different people and thoughts and existing mechanism is sufficient i.e. one can even argue that it is even more flexible than identity btw ;)
Gints Plivna
http://www.gplivna.eu

Similar Messages

  • Identity Column in SQL Server 2000

    I am working on SBO Version 2004a.
    I created <b>Identity Column</b> in User Defined Table and made the entries for this Table and its columns in Sap Business One OUTB and CUFD tables respectivily.
    I use this identity column to populate the Code and name fields automatically using Insert triggers.
    I add 10 records to the table and now delete the 5th record. The Identity column and the code field will contain values as (1,2,3,4,6,7,8,9,10)
    Now on Upgrading the patch level( SAP Business One 2004A (6.70.190)  SP: 00  PL: 36), the Identity column is converted to simple INT column and no Identity column property is attached to it.
    There is no T-SQL in SQL 2000 to convert an existing column to Identity Column hence I can not convert it back to Identity Column.
    The Only Solution is to drop the column and re-create it as an Identity Column.
    If I do so, the Identity column is polulated for all the rows starting from 1 to 9 (seed is 1).
    Now on adding the next record, the primary key voilation occurs on the Code field since the next available Identity column value is 10 but this value is already used in 9th record.
    <b>Is there any way so that the patch do not change the definition of the User defined tables and their columns.</b>
    Thanks
    Vishal Nigam

    Hi Vishal,
    I agree with Harold. It's against SAP's support policy to allow anyone to change SBO table definitions in any way. Other SQL objects such as stored procedures or triggers will probably be unaffected by an upgrade but it is highly likely that changes to tables will be reverted and may even cause the upgrade to fail.
    There is one other possible solution, depending on how you are using the table. It is to create your own table in SQL, i.e. a table in the SBO company database but which is not a user-defined table. SBO itself will be totally unaware of the table but you could read and write to it via code (if you have written an add-on).
    Kind Regards,
    Owen

  • Oracle 9i on LINUX Transparent Gateway for SQL Server

    Does anybody know if there is a Transparent Gateway available for Oracle 9i on LINUX to connect to SQL Server? I have run the installer and cannot seem to find the install options for any Transparent Gateways. I am familiar with their location in the universal installer as I have installed the Oracle/SQL Server Transparent Gateway with Oracle in WinNT. Perhaps Transparent Gateways for Oracle/LINUX are not available?
    Thanks in advance.

    I have the same issue - we want to upgrade our 9.2 to 10g Linux, and need to maintain connectivity to some legacy sqlserver databases. I can't find any mention of tg4msql for linux. What gives? Anyone know the answer to this? thanks, michael

  • Desc doesn't show datetime columns from SQl Server

    Hi Everyone,
    I have working db link to sql server using hsodbc:
    Oracle 10.2 on AIX using freetds odbc driver version 0.82.
    I can access tables on sql server but oracle sees only varchars and numerics columns in a table.
    Is there a way to select datetime columns from sql server using hsodbc?

    when hsodbc does not show a certain data type it is commonly related to the fact that HSODBC doesn't support the related ODBC data type.
    In general you have a data type in your SQL Server which is mapped to an ODBC data type by the ODBC driver. HSODBC then maps the ODBC data type to an Oracle equivalent and when the ODBC data type isn't supported by HSODBC it just drops it from the select list.
    So for a root cause analysis an ODBC trace is required to determine the mapping of the FreeTDS ODBC driver.
    With this info we can then compare the mapping documented in the HSODBC manual and if the ODBC data type isn't listed as a supported data type you then need to cast the data type on the source side to a different data type (for example varchar/char).
    So please post the ODBC trace and I'll have a look.
    - Klaus
    Edited by: kgronau on Apr 2, 2013 12:50 PM
    BTW, here the link to the HSODBC docu:
    http://docs.oracle.com/cd/B19306_01/server.102/b14232.pdf
    Oracle® Database
    Heterogeneous Connectivity Administrator's Guide
    10g Release 2 (10.2)
    B14232-01
    B.1 Mapping ANSI Data Types to Oracle Data Types Through an ODBC
    Interface

  • How to export an image column from SQL server to an excel

    Hi team,
    Would like to know how can i get an Image column storeed in SQL Server database to get copied in Excel (Hard Drive).
    Requirement : Need to get Username, User email address and User photo in to an excel sheet from SQL server database.
    Fix: I can get Username and Useremail adress however could not find a way to export /Copy user Image.
    Please suggest
    Thanks,
    venkatesh

    This is an Oracle forum. Your question relates to SQL Server and Excel, neither of which are Oracle related.

  • Study: Oracle database software has more flaws than SQL Server

    Hi,
    Study: Oracle database software has more flaws than SQL Server
    Microsoft is often unfairly slammed for security issues, says NGSS
    http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9005383&intsrc=hm_list
    Post your comments on this stupid artical.
    Thanks!
    M T

    This is a case where size does matter.
    When they say errors reported on oracle are about 4 times more than the ones reported on SQL server they forgot to say something like: SQL server is able to do... what a 10%, a 5% or whatever of what oracle can do.
    Anyway who sayd this forgot to say that they worked with microsoft trying to improve SQL sever security features as well.
    http://www.nextgenss.com/press-releases/ngs-and-the-sql-server-security-essential-guide/
    They have a reason to say it. Who would say "I made a bad job!"
    In my opinion there is no way yet to compare oracle to any other DBMS under any point of view.
    Bye Alessandro

  • What is difference between 32 bit and 64 bit sql server memory management

    What is difference between 32 bit and 64 bit sql server memory management
    Thanks
    Shashikala

    This is the basic difference...check if helps:
    A 32-bit CPU running 32-bit software (also known as the x86 platform) is so named because it is based on an architecture that can manipulate values that are up to 32 bits in length. This means that a 32-bit memory pointer can store a value between 0 and
    4,294,967,295 to reference a memory address. This equates to a maximum addressable space of 4GB on 32-bit platforms
    On the other hand 64-bit limit of 18,446,744,073,709,551,616, this number is so large that in memory/storage terminology it equates to 16 exabytes. You don’t come across that term very often, so to help understand the scale, here is the value converted to
    more commonly used measurements: 16 exabytes = 16,777,216 petabytes (16 million PB)➤ 17,179,869,184 terabytes (17 billion TB)➤ 17,592,186,044,416 gigabytes (17 trillion GB)➤
    As you can see, it is significantly larger than the 4GB virtual address space usable in 32-bit systems; it’s so large in fact that any hardware capable of using it all is sadly restricted to the realm of science fiction. Because of this, processor manufacturers
    decided to only implement a 44-bit address bus, which provides a virtual address space on 64-bit systems of 16TB. This was regarded as being more than enough address space for the foreseeable future and logically it’s split into an 8TB range for user mode
    and 8TB for kernel mode. Each 64-bit process running on an x64 platform will be able to address up to 8TB of VAS.
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • Ident_Current('TableName') not giving last inserted identity Value in SQL Server 2012

    Hi ,
    Ident_Current('TableName') is not giving last inserted identity Value in SQL Server 2012. 
    Latest Value of ID and Ident_Current is differing for that particular table.  
    Why its happening? Ident_Current value is greater than last inserted ID.
    Please guide me why its happening?

    Here is one example:
    CREATE DATABASE PMCtest ON (NAME = 'PMCtest', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.mdf', SIZE = 25GB )
    LOG ON (NAME = 'PMCtest_log', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.ldf', SIZE = 2GB)
    CREATE TABLE identity_crisis (a int IDENTITY NOT NULL PRIMARY KEY,
                                  b sysname NOT NULL CHECK (b <> 'sysschobjs'))
    go
    INSERT identity_crisis (b) VALUES ('First name')
    INSERT identity_crisis SELECT name FROM sys.objects
    go
    SELECT MAX(a), ident_current('identity_crisis')
    FROM  identity_crisis
    go
    DROP TABLE identity_crisis
    Because the second INSERT statement fails, the identity values from 2 to 12 are lost. This is a very intentional design to promote high concurrency. If you don't want gaps, you should not use IDENTITY, but roll your own.
    Also, beware that ident_current returns database-wide value, so if you insert one row, and another process inserts another row before you interrogate ident_current, you will get the id for the row of the other process.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to convert rows to columns in sql server 2008

    How to convert rows to columns in sql server 2008 using the GROUP BY function? (only one query allowed)

    Lookup the Pivot transformation. From BOL:
    The Pivot transformation makes a normalized data set into a less normalized
    but more compact version by pivoting the input data on a column value. For
    example, a normalized Orders data set that lists customer name, product, and quantity purchased typically has multiple rows for any customer who purchased multiple products, with each row for that customer showing order
    details for a different product. By pivoting the data set on the product column, the Pivot transformation can output a data set with a
    single row per customer. That single row lists all the purchases by the customer, with the product names shown as column names, and the quantity shown as a value in the product column. Because not every customer purchases every product, many columns may contain
    null values.
    When a dataset is pivoted, input columns perform different roles in the pivoting process. A column can participate in the following ways:
    The column is passed through unchanged to the output. Because many input rows
    can result only in one output row, the transformation copies only the first
    input value for the column.
    The column acts as the key or part of the key that identifies a set of
    records.
    The column defines the pivot. The values in this column are associated with
    columns in the pivoted dataset.
    The column contains values that are placed in the columns that the pivot
    creates.
    Paul

  • What is the correct wording to connect to an SQL Server Express 2014 database?

    I am connecting to an Access 2007 database:
    oleConnection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\...\\Db.accdb");
    What is the correct wording to connect to an SQL Server Express 2014 database?
    bhs67

    Hello,
    Please make sure you change RemoteServer with the computer name of the intended SQL Server server.
    Make sure the SQL Server instance have enable TCP/IP and Named Pipes protocols. Use the following article to enable them:
    http://msdn.microsoft.com/en-us/library/ms191294.aspx
    Start SQL Server Browser Service using SQL Server Configuration Manager.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • New To Oracle.. Needs Help:: Conversion from SQL Server to Oracle 11g

    I am new to Oracle 11g and badly need the conversion of SQL Server Functions to Oracle.. Sample Pasted Code not working .. end with error.. pls help
    Create Table TempT (ID1 Varchar (10),
    ID2 Varchar (10)
    CREATE OR REPLACE PACKAGE GLOBALPKG
    AS
    TYPE RCT1 IS REF CURSOR;
    TRANCOUNT INTEGER := 0;
    IDENTITY INTEGER;
    END;
    CREATE OR REPLACE FUNCTION fTempT
    i IN VARCHAR2 DEFAULT NULL
    RETURN GLOBALPKG.RCT1
    IS
    REFCURSOR GLOBALPKG.RCT1;
    BEGIN
    OPEN REFCURSOR FOR
    SELECT TT.*
    FROM TempT TT
    WHERE (fTempT.i = ''
    OR TT.ID1 = fTempT.i)
    RETURN REFCURSOR;
    END;
    CREATE OR REPLACE FUNCTION fTempTF
    i IN VARCHAR2 DEFAULT NULL
    RETURN GLOBALPKG.RCT1
    IS
    REFCURSOR GLOBALPKG.RCT1;
    BEGIN
    OPEN REFCURSOR FOR
    SELECT *
    FROM TABLE(fTempT(i))
    RETURN REFCURSOR;
    END;
    LAST FUNCTION ENDs WITH ERROR
    Error(13,7): PL/SQL: ORA-22905: cannot access rows from a non-nested table item

    2. The major purpose is to get a simplest way to create a parameterized function who can return a table like output. 2nd function has no use instead i was testing the result of First Function like thisIf you just want to select from a select, you should use a view not a function.
    1. which program is more help ful for writing and executing queries bcoz after using Query Analyzer of Microsoft It seems difficult to work on SQL Developer.
    sqlplus? If you are having difficulty learning new tools because of an old one you used, probably best to forget the old one and concentrate on learning the new one because it will be different. This goes for the database itself also.
    2. Can DMLs be used within a Function.Yes, you just can't execute the function in another SQL statement if it modifies data and this is a good thing.
    3. Can temporary tables be used within a function.Unfortunately yes, but they shouldn't be unless you are in a slowest application competition.
    5. Each Function which is a Table Function must be accompanied with Type Definitions?? its a bit longer way of doing the things than SQL ServerThat is why it is better to use views instead, is there any reason you want a select that you can select from inside a function?
    SQL Server for last 9 years thats why i refer this toolThat is not in itself a problem, if you try and do what you did in SQLServer in Oracle, that will be a problem though.

  • Accessing IMAGE Columns in SQL Server

    I'm trying to use the TG4MSSQL to access tables in a SS2k database. All is well, except for 1 table that has an IMAGE column in it. I must say that I'm a little surprised and disappointed that the 10gR2 gateway for MSSQL apparently translates these things into LONG RAW columns, which are known to be antiquated and minimally supported. However, I still need access to the data, and ultimately, I need it in a BLOB. Doing simple queries (in TOAD) such as:
    select * from image@tg4ss where image_id = 1;
    returns the row, and I can use TOAD to determine that all the data is there. However, apparently, you cannot use PL/SQL to bind more than 32K of this data into a variable, so I haven't had much success there.
    The only way I know of converting a long raw to a blob is to use the to_lob function, but that's only good in the select list of a subquery of an insert statement. Thing is, that doesn't seem to work with the gateway. I tried something like:
    insert into my_blob_table( id, image )
    select id, to_lob(image) as image from image@tg4ss where id = 1;
    That gets me a ORA-00997: illegal use of LONG datatype.
    In fact, I can't even do this:
    insert into my_long_raw_table( id, image )
    select id, image from image@tg4ss where id = 1;
    I get the same error on that command.
    Now, I can do this, but I only get the first 32k of the image:
    begin
    for I in (select id, image from IMAGE@tg4ss)
    loop
    insert into my_long_raw_table( id, image )
    values (I.id, I.image);
    end loop;
    end;
    So, does anyone know how you can get image data out of an SQL Server database into a blob value? If so, I'd appreciate a reply. Thanks.
    -Rich.

    Hello Rich,
    I found your article after running into the same problem. I imagine you've dealt with this one way or another already but just in case...
    The reason the LONG RAW gets truncated is explained in:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#i43252
    Basically, LONG RAW variables are limited to 32760 bytes inside PL/SQL. The ORA-00997 error is explained a little in:
    http://www.dbaxchange.com/3_4_longdatatypes.htm
    The only solution I found to work was to create a Java utility that read in each LONG RAW value (one at a time) and then update a record in a table's BLOB column. This was even a bit tricky. I found the gateway would lock up if I tried to do too much at a time. I kept it simple my reading all column IDs into an array and then looping through the array while executing a simple select statement that retrieved the LONG RAW value. I concatenated the id to the end of the select statement because prepared statements seemed to be one of the reasons the gateway locked up. I used a ByteArrayInputStream object to populate the BLOB in an update prepared statement for each LONG RAW value processed in the loop.
    - Aaron

  • How mapping sharepoint list Columns to Sql server data table columns programaticlly

    Hi ,
     I have one Verification List in share Point ,in that list i have 10 columns.And we have sql server in that sql server we have one data table Verification_Table
    in that table we have 25 column, my requirement is all list data  move to  sql data table[ what ever columns mapping to list--->data table that data store in data table reaming column is  Null]
     using grammatically not in BCS

    Hello,
    You can create SQL connection and use Datareader to read from SQL.Firs create a connection string and put this string in web application web.config file of your sharepoint site.
    Now use below code to call your connectionstring in your webpart.
    SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);
    Here is link to read the data from SQL:
    http://www.akadia.com/services/dotnet_data_reader.html
    Here is one MSDN link to read SP list data:
    http://msdn.microsoft.com/en-us/library/dd490727%28v=office.12%29.aspx
    Let me know if you have any doubt
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Nvarchar column filter - SQL server

    Hello,
    I am using OBIEE 10.1.3.4.2 and I have problem with filtering data coming from SQL server 2008. I am using ODBC connection to access SQL server data. I can see results of my queries without any problem.
    But I have problem with filtering.
    My answer use these columns:
    Id (varchar(36))
    Code (nvarchar(256))
    Name (nvarchar(256))
    HappenedOn (date)
    Please look on this screenshost:
    http://img59.imageshack.us/img59/5242/obieenvarcharcolumn.jpg
    Screenshot
    I have problem when I want to use filter on Code column and use some non-english characters. Specifically Czech characters in windows1250 code page. With that filter I am getting "No result" view. But generated select is working in Microsoft SQL Server Management Studio.
    I think there is some problem with ODBC resource or BI configuration, but I can not find reason of this behaviour.
    Do I need to make some specific configuration to use NVARCHAR columns? Specifiy some encoding etc....
    Thank you

    Thank you Dpka...
    Checking UNICODE option on Write Back tab solved my problem. It is realy nice hidden property :-)
    But my fight is not over...
    Now I am getting error when I try to make join between table from Oracle and table from SQL server.
    It is a Bug ID 9147807 and I hope that Patch (9147807: INCORRECT SYNTAX NEAR 'SESSION' WHEN QUERYING FRAGMENTED LOGICAL FACT TABLE) will help me.

  • Oracle 11.1.0.7 x64 to SQL Server 2008 connectivity

    Hi There,
    I'm trying to establish connectivity between oracle database running 11.1.0.7 64bit on windows 2008 server x64 to sql server 2008 database. Both databases (oracle and SQL) are on the same machine.
    I know with the older oracle versions, we used to setup hs connection between the two databases, however, I've been reading note 466225.1 (How To : How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit) on metalink and it states the following:
    >
    Please be aware:
    - DG4ODBC is first ported to 64bit Windows platforms starting with 11.2. Using a 32bit DG4ODBC on a 64bit Windows operating system is NOT certified.
    - HSOLEDB is no longer available for 11g on Windows.
    >
    So, according to the above, I'm guessing that we won't be able to use dg4odbc to establish the connectivity between the two.. how about the old hsodbc setup under ORACLE_HOME\hs\admin ? would that work? or is there another way that w can do this?
    I've been working on this and trying to get it going but not sure if I'm doing something wrong or it just doesn't work here..
    On the server I did the following:
    1. created the sqlserver DSN and tested the connection and it's all ok.
    2. added the following to the tnsnames.ora
    SQLCentralODBC  =
      (DESCRIPTION=
        (ADDRESS=(PROTOCOL=tcp)(HOST=188.87.135.90)(PORT=1522))
        (CONNECT_DATA=(SID=SQLCentralODBC))
        (HS=OK)
      ) 3. added the following to the listener.ora:
    LISTENER_ELMSCENTRAL =
    (ADDRESS_LIST=
          (ADDRESS=(PROTOCOL=tcp)(HOST=188.87.135.90)(PORT=1522))
    SID_LIST_LISTENER_SQLCENTRAL=
      (SID_LIST=
          (SID_DESC=
             (SID_NAME=SQLCentralODBC)
             (ORACLE_HOME=C:\oracle\product\11.1.0.7)
             (PROGRAM=hsodbc)
      )4. the listener started ok, and I validated the dsn connection and it's all ok:
    C:\Users\oracle>tnsping SQLCentralODBC
    TNS Ping Utility for 64-bit Windows: Version 11.1.0.7.0 - Production on 21-MAY-2010 15:47:12
    Copyright (c) 1997, 2008, Oracle.  All rights reserved.
    Used parameter files:
    C:\oracle\product\11.1.0.7\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=188.87.135.90)(PORT=1522)) (CONNECT_DATA=(SID=SQLCentralODBC)) (HS
    =OK))
    OK (10 msec)
    C:\Users\oracle>5. created the db link:
    SQL> create database link LM_SQLC connect to sqlc_user identified by xxx using 'SQLCentralODBC';
    Database link created.6. Test the connection:
    SQL> select * from event@LM_SQLC;
    select * from event@LM_SQLC
    ERROR at line 1:
    ORA-28545: error diagnosed by Net8 when connecting to an agent
    Unable to retrieve text of NETWORK/NCR message 65535
    ORA-02063: preceding 2 lines from LM_SQLC
    SQL>Any ideas/help will be really appreciated.
    Thanks alot.
    Edited by: user4415740 on May 21, 2010 12:36 PM
    Edited by: user4415740 on May 21, 2010 12:52 PM

    They say "Using a 32bit DG4ODBC on a 64bit Windows operating system is NOT certified." but we do it extensively and it works just fine. You need to install a 32-bit home and create a listener for the 32-bit gateway. Only downside (aside from maintaining 2 homes) is that if you need to file an SR, you must prove that you're able to reproduce the problem when the gateway is running on a 32-bit OS. We keep a little 32-bit server around for this purpose and point our gateways to that box to reproduce issues for SR's.
    If you want to run "certified" all the time, you could leave the gateways running in Production on a 32-bit OS, but it runs considerably slower this way, and all because Oracle won't support your SR's. You have to decide if you really think you'll hit an issue that wouldn't reproduce on the true 32-bit OS and decide if it's worth the risk. We've made our decision...
    Good luck!

Maybe you are looking for