Article View: chile.comp.programacion
Article #3492Re: Consulta SQL
From: Jose I. Moya Villegas
Date: Thu, 27 Jan 2005 14:18
Date: Thu, 27 Jan 2005 14:18
88 lines
3734 bytes
3734 bytes
no se realmente si puedes crear una tabla con un campo que se incremente automaticamente, pero si realmente quieres hacer eso y estas apurado en una solucion, en el procedimiento que inserta en esa tabla haces: declare max_campo int select max_campo = max(campo) from tabla select max_campo = max_campo + 1 insert ( campo ) values ( max_campo ); Herrynet dijo: > This is a multi-part message in MIME format. > > ------=_NextPart_000_0014_01C4FCCB.3D0365D0 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Salu2 > > He estado googleando para saber si existe alguna forma de hacer que un = > campo al crear una tabla esta sea de auto incremento, al igual como = > sucede con mysql pero llevado a sql-server > > ej: CREATE TABLE prueba (campo1 int not null auto_increment,campo2 text) > > Esto lo quiero llevar a Sql-server.... > Cualquier ayuda se agradece de Antemano > > ATTe > > Herrynet > ------=_NextPart_000_0014_01C4FCCB.3D0365D0 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > <HTML><HEAD> > <META http-equiv=3DContent-Type content=3D"text/html; = > charset=3Diso-8859-1"> > <META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR> > <STYLE></STYLE> > </HEAD> > <BODY> > <DIV><FONT face=3DArial size=3D2>Salu2</FONT></DIV> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV> > <DIV><FONT face=3DArial size=3D2>He estado googleando para saber si = > existe alguna=20 > forma de hacer que un campo al crear una tabla esta sea de auto = > incremento, al=20 > igual como sucede con mysql pero llevado a sql-server</FONT></DIV> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV> > <DIV><FONT face=3DArial size=3D2>ej: CREATE TABLE prueba (campo1 int not = > null=20 > <STRONG>auto_increment</STRONG>,campo2 text)</FONT></DIV> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV> > <DIV><FONT face=3DArial size=3D2>Esto lo quiero llevar a = > Sql-server....</FONT></DIV> > <DIV><FONT face=3DArial size=3D2>Cualquier ayuda se agradece de=20 > Antemano</FONT></DIV> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV> > <DIV><FONT face=3DArial size=3D2>ATTe</FONT></DIV> > <DIV><FONT face=3DArial size=3D2></FONT> </DIV> > <DIV><FONT face=3DArial size=3D2>Herrynet</FONT></DIV></BODY></HTML> > > ------=_NextPart_000_0014_01C4FCCB.3D0365D0-- -- Escribe aqu� tu firma, no el texto del mensaje. Puedes especificar una firma definitiva en Preferencias.
Technical Details
Message-ID:
<20050127111813.t2kynt@webnews.inf.utfsm.cl>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.inf.utfsm.cl!not-for-mailReferences:
<cshee2$9dl$1@news1.nivel5.cl>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,820b62b9f5b6ab97 X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.inf.utfsm.cl!not-for-mail From: Jose I. Moya Villegas <jmoya@inf.utfsm.cl> Newsgroups: chile.comp.programacion Subject: Re: Consulta SQL Date: Thu, 27 Jan 2005 14:18:13 +0000 (UTC) Organization: Universidad Tecnica Federico Santa Maria Lines: 88 Message-ID: <20050127111813.t2kynt@webnews.inf.utfsm.cl> References: <cshee2$9dl$1@news1.nivel5.cl> NNTP-Posting-Host: manutara.inf.utfsm.cl X-Trace: manutara.inf.utfsm.cl 1106835493 5058 200.1.19.37 (27 Jan 2005 14:18:13 GMT) X-Complaints-To: newsadmin@inf.utfsm.cl NNTP-Posting-Date: Thu, 27 Jan 2005 14:18:13 +0000 (UTC) User-Agent: Mantra 0.5/Beta 5.4 (Silvestre) X-Mantra-Score: 3.000000 X-Mantra-Id: 3915cb27d6a96f6caab8e1c84659550b X-Mantra-UserId: 533 X-HTTP-Posting-Host: 200.54.180.186 X-HTTP-User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)