X-Received: by 10.67.3.5 with SMTP id bs5mr42549431pad.35.1438180283768; Wed, 29 Jul 2015 07:31:23 -0700 (PDT) X-Received: by 10.140.101.22 with SMTP id t22mr575266qge.32.1438180283490; Wed, 29 Jul 2015 07:31:23 -0700 (PDT) Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!pg9no5045723igb.0!news-out.google.com!b31ni1108qge.0!nntp.google.com!69no2623967qgl.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.databases.ms-sqlserver Date: Wed, 29 Jul 2015 07:31:23 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=190.104.153.107; posting-account=VrDeogoAAACDgQd3w0z6TPAA82cnrCLk NNTP-Posting-Host: 190.104.153.107 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6141367c-ecc2-4a6b-aa21-1b006053a8fb@googlegroups.com> Subject: Re: WHILE LOOP AS FOR LOOP From: =?ISO-8859-1?Q?Jessica_Gonz=E1lez?= Injection-Date: Wed, 29 Jul 2015 14:31:23 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.databases.ms-sqlserver:1929 thanks.. but SET IDENTITY_INSERT table ON; INSERT INTO table(pk,activo,permiso,rol) SELECT IDENT_CURRENT('table')+1,'S',id, 1 FROM table2 return error Violation of PRIMARY KEY constraint 'PK__table__3213E83F2B947552'. Cannot insert duplicate key in object 'table'. The duplicate key value is (6). only 'id' i need get from table2