Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #445

Re: problem from proc call and autoincreasing key in using otl

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: problem from proc call and autoincreasing key in using otl
Date Mon, 13 Jun 2011 07:23:03 +0000 (UTC)
Organization Erland Sommarskog
Lines 21
Message-ID <Xns9F035F76A937CYazorman@127.0.0.1> (permalink)
References <3c4bb9a9-97ed-4a95-9982-2afd993017bd@34g2000pru.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Injection-Date Mon, 13 Jun 2011 07:23:03 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="G7+Jz22XqYCG8C6rb1H3YA"; logging-data="28766"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OyBlZyjM8vKEjrKuaoyK+"
User-Agent Xnews/2005.10.03 Mime-proxy/1.4.c.4 (Win32)
Cancel-Lock sha1:sj9QxyajpTYNi9EiXXRkbM8iA+s=
Xref x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:445

Show key headers only | View raw


white_ideal (whiteideal@gmail.com) writes:
> 1. how to get the autoincreasing identity immediately after inserting
> a row? I how you can give me the answer within mysql and sqlserver.

In SQL Server, use scope_identity(), which must be in the same batch as the 
INSERT statement.

For MySQL, you need to ask in an MySQL forum.

> 2. why the following code is error with "invalid cursor state"?
>           the source code is like this.
 
I will have to admit that I have never seen this OTL before.

-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

problem from proc call and autoincreasing key in using otl white_ideal <whiteideal@gmail.com> - 2011-06-12 17:08 -0700
  Re: problem from proc call and autoincreasing key in using otl Erland Sommarskog <esquel@sommarskog.se> - 2011-06-13 07:23 +0000
    Re: problem from proc call and autoincreasing key in using otl Gene Wirchenko <genew@ocis.net> - 2011-06-13 07:28 -0700
      Re: problem from proc call and autoincreasing key in using otl Erland Sommarskog <esquel@sommarskog.se> - 2011-06-13 23:59 +0200
        Re: problem from proc call and autoincreasing key in using otl Henk van den Berg <me@myplace.net> - 2011-06-14 08:35 +0200
  Re: problem from proc call and autoincreasing key in using otl white_ideal <whiteideal@gmail.com> - 2011-06-13 15:13 -0700
    Re: problem from proc call and autoincreasing key in using otl Erland Sommarskog <esquel@sommarskog.se> - 2011-06-14 23:39 +0200
      Re: problem from proc call and autoincreasing key in using otl white_ideal <whiteideal@gmail.com> - 2011-06-14 15:36 -0700
        Re: problem from proc call and autoincreasing key in using otl white_ideal <whiteideal@gmail.com> - 2011-06-14 17:33 -0700
  Re: problem from proc call and autoincreasing key in using otl white_ideal <whiteideal@gmail.com> - 2011-06-14 17:34 -0700

csiph-web