Comparison between oracle and sqlserver

Source: Internet
Author: User

1. oracle only provides cascading deletion when creating tables, and sqlserver provides cascading deletion and update. Although the primary key value of the primary table cannot be modified frequently after the primary-foreign key relationship is established, this requirement is sometimes applied .) Oracle provides three options to set null, cascade, and do nothing when deleting oracle. In addition to the three options, SQL Server also provides default values.


2. oracle does NOT provide auto-increment of primary keys, which must be implemented using a sequence plus trigger. sqlserver provides auto-increment of primary keys [proId] [int] IDENTITY () not null, in the identity specification, the primary key is automatically generated after the incremental flag seed is set.

Add sequence:

Create sequence seq_depid

Minvalue 1

Max value 99999

Start with 1

Increment by 1

Nocache;

Trigger creation:

Create or replace trigger trg_depid

Before insert on dep

For each row

When (new. depid is null)

Begin

Select seq_depid.nextval into: new. depid from dual;

End trg_depid;


This article is from the "love IT" blog, please be sure to keep this source http://5563447.blog.51cto.com/5553447/1305044

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.