pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carl van Tast <vanTast.no@spam.netway.at>
To: pgsql-sql@postgresql.org
Subject: Re: default value syntax - pg compared to?
Date: Tue, 13 Mar 2001 00:34:09 +0100
Message-ID: <37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com> (raw)
References: <web-23712@davinci.ethosmedia.com>

On Mon, 12 Mar 2001 20:52:02 +0000 (UTC), josh@agliodbs.com ("Josh
Berkus") wrote:

>1. Unlike PostgreSQL, MSSQL server will not permit you to override an
>"Identity Value" auto-incrementing field;

That's almost correct. You cannot *update* an identity column, but you
can override it on insert if you use
    SET IDENTITY_INSERT tablename ON

create table foo (id integer identity, txt varchar(10))
go
insert into foo (txt) values ('a')
insert into foo (txt) values ('b')
set identity_insert foo on
insert into foo (id, txt) values (10, 'c')
set identity_insert foo off
insert into foo (txt) values ('b')
select * from foo

id          txt        
----------- ---------- 
1           a
2           b
10          c
11          d

(4 row(s) affected)

.02 by
 Carl van Tast



view thread (4+ messages)

Message-ID: <37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com>
Permalink:  ../37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com/
Also on:    postgresql.org/message-id/37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: vanTast.no@spam.netway.at
  Subject: Re: default value syntax - pg compared to?
  In-Reply-To: <37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com>
  References: <web-23712@davinci.ethosmedia.com> <37mqat0o6n65n1f2lbbg9frd0hftvl39a0@4ax.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox