In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Consulta sobre SqlLite

Foro público de Xailer en español
Responder
Christian
Mensajes: 290
Registrado: Mié Abr 23, 2008 10:18 pm

Consulta sobre SqlLite

Mensaje por Christian »

Hola hay estoy probando SqlLite y no puede hacer andar la integridad
referencial, he leido y releido la ayuda y nada:
CREATE TABLE PAISES
(
CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
DESCRIPCION CHAR(40) NOT NULL
);
CREATE TABLE PROVINCIAS
(
CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
DESCRIPCION CHAR(40) NOT NULL,
PAIS INTEGER NOT NULL CONSTRAINT CTRL_PAIS FOREIGN KEY (PAIS)
REFERENCES PAISES (CODIGO)
);
Si alguien me puede dar una mano gracias.
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Consulta sobre SqlLite

Mensaje por jfgimenez »

Christian,
> Hola hay estoy probando SqlLite y no puede hacer andar la integridad
> referencial, he leido y releido la ayuda y nada:
>
> CREATE TABLE PAISES
> (
> CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
> DESCRIPCION CHAR(40) NOT NULL
> );
>
> CREATE TABLE PROVINCIAS
> (
> CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
> DESCRIPCION CHAR(40) NOT NULL,
> PAIS INTEGER NOT NULL CONSTRAINT CTRL_PAIS FOREIGN KEY (PAIS) REFERENCES
> PAISES (CODIGO)
> );
>
> Si alguien me puede dar una mano gracias.
SQLite no soporta claves ajenas o foráneas. La única forma de hacerlo es
usando triggers. Mira en esta página:
http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers
--
Un saludo,
José F. Giménez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
Carlos Ortiz
Mensajes: 873
Registrado: Mié Jul 01, 2009 5:44 pm
Ubicación: Argentina - Córdoba
Contactar:

Consulta sobre SqlLite

Mensaje por Carlos Ortiz »

Solo como comentario...
SQLite no es un motor de datos, es similar a una MDB de MS Acces.
Como para safar de las DBF podes usar SQLite pero con el tiempo verás que
usando motor es mucho mejor.
Yo me pasé a Xailer + Postgres viniendo de FiveWin + Dbfs, y si lleva un
tiempo cambiar el chip pero vale la pena. Lo recomiendo ampliamente.
Atte. Carlos Ortiz.
Christian
Mensajes: 290
Registrado: Mié Abr 23, 2008 10:18 pm

Consulta sobre SqlLite

Mensaje por Christian »

Gracias ahora lo pruebo.
Christian R.Assenza escribió:
> Hola hay estoy probando SqlLite y no puede hacer andar la integridad
> referencial, he leido y releido la ayuda y nada:
>
> CREATE TABLE PAISES
> (
> CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
> DESCRIPCION CHAR(40) NOT NULL
> );
>
> CREATE TABLE PROVINCIAS
> (
> CODIGO INTEGER NOT NULL PRIMARY KEY ASC AUTOINCREMENT,
> DESCRIPCION CHAR(40) NOT NULL,
> PAIS INTEGER NOT NULL CONSTRAINT CTRL_PAIS FOREIGN KEY (PAIS)
> REFERENCES PAISES (CODIGO)
> );
>
> Si alguien me puede dar una mano gracias.
Responder