Crear base de datos
Necesito el strip para crear una base de datos desde power buider (instruccion create) y el scrip para crear tablas .
1 Respuesta
Respuesta de mgodoy
1
1
mgodoy, Ingeniero en Sistemas
Antes que nada, me tendrías que indicar que motor de base de datos vas a utilizar. Puede ser Sybase, Sybase anyware, etc. Te puedo pasar un ejemplo para estos motores.
Otra posibilidad es que uses en PowerDesigner para armar tu modelo y luego generes el scripts automaticamente.
Otra posibilidad es que uses en PowerDesigner para armar tu modelo y luego generes el scripts automaticamente.
Hola mgodoy.
la base de datos es una sybase anywhere .
si tenes un ejemplo para poder hacerlo con una tabla tambien te lo agradeceria.
saludos
Hernan Magallanes
la base de datos es una sybase anywhere .
si tenes un ejemplo para poder hacerlo con una tabla tambien te lo agradeceria.
saludos
Hernan Magallanes
Hernan,
Te paso un scrip con un ejemplo en la creación de tablas, pero te conviene crear la base de datos a través de la aplicación "Sybase Central" que viene con el anyware. Con ella podes crear la base de datos, usuarios, grupos, tablas, procedimientos, y asignar permisos. Es muy simple de usar. Por otro lado para armar el modelo de datos es muy bueno el powerdesigner, también es una herramienta de sybase y la misma te genera todo el código para que crees las tablas, llaves foranes y primarias, etc.
Te paso algo de código donde tenés de todo un poco, creación de usarios, tablas procedimientos, etc. Cualquier duda no dudes en consultarme
Saludos y Feliza Navidad.
Miguel
% Usage: isql read F:\MODELOS\DB_JUDIC\RELOAD.SQL
%
% This command file reloads a database that was unloaded using "dbunload".
%
% (Version: 5.5.04 Build #1867)
%
SET OPTION Statistics = 3
go
SET OPTION Date_order = 'YMD'
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create userids and grant user permissions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT CONNECT TO "DBA" IDENTIFIED BY ENCRYPTED '\x6E\x27\xE3\x58\x69\x8C\x6C\x2B\x63\x45\x3A\xC9\x01\x3F\x40\x01\x03\xF1\x31\x0E\x8D\x1C\x57\x45\x4A\xC9\xCE\x42\x4B\xAC\x93\x6F\xBC\xFE\xA6\xD3'
Go
Grant resource, dba, schedule to "dba"
Go
GRANT CONNECT TO "dbo"
Go
GRANT GROUP TO "dbo"
Go
Grant resource, dba to "dbo"
Go
GRANT CONNECT TO "mgodoy" IDENTIFIED BY "SQL"
Go
GRANT DBA, REMOTE DBA TO "mgodoy"
Go
GRANT CONNECT TO "rcapra" IDENTIFIED BY ENCRYPTED '\x08\x35\xBC\x7C\x2D\xC9\x62\x2E\x44\x18\xF8\x7D\x03\x65\x89\x96\xD4\xDE\x44\x30\x1D\x3D\xCE\x39\x89\xE8\xFC\xD7\x8B\x36\x6A\xA7\x7F\x50\xC9\x01'
Go
GRANT RESOURCE, DBA, REMOTE DBA TO "rcapra"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create user-defined types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE DOMAIN T_money numeric(19,4)
Go
CREATE DOMAIN T_smallmoney numeric(10,4)
Go
CREATE DOMAIN T_datetime timestamp
Go
CREATE DOMAIN T_smalldatetime timestamp
Go
CREATE DOMAIN T_text long varchar
go
CREATE DOMAIN T_image long binary
go
CREATE DOMAIN T_bit tinyint NOT NULL
go
CREATE DOMAIN T_sysname varchar(30) NOT NULL
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT MEMBERSHIP IN GROUP "dbo" TO "DBA"
go
GRANT MEMBERSHIP IN GROUP "dbo" TO "mgodoy"
go
GRANT MEMBERSHIP IN GROUP "dbo" TO "rcapra"
Go
CREATE TABLE "mgodoy"."pbcattbl"
(
"pbt_tnam" char(129) NOT NULL,
"pbt_tid" integer NULL,
"pbt_ownr" char(129) NOT NULL,
"pbd_fhgt" smallint NULL,
"pbd_fwgt" smallint NULL,
"pbd_fitl" char(1) NULL,
"pbd_funl" char(1) NULL,
"pbd_fchr" smallint NULL,
"pbd_fptc" smallint NULL,
"pbd_ffce" char(18) NULL,
"pbh_fhgt" smallint NULL,
"pbh_fwgt" smallint NULL,
"pbh_fitl" char(1) NULL,
"pbh_funl" char(1) NULL,
"pbh_fchr" smallint NULL,
"pbh_fptc" smallint NULL,
"pbh_ffce" char(18) NULL,
"pbl_fhgt" smallint NULL,
"pbl_fwgt" smallint NULL,
"pbl_fitl" char(1) NULL,
"pbl_funl" char(1) NULL,
"pbl_fchr" smallint NULL,
"pbl_fptc" smallint NULL,
"pbl_ffce" char(18) NULL,
"pbt_cmnt" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcattbl" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcattbl" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatcol"
(
"pbc_tnam" char(129) NOT NULL,
"pbc_tid" integer NULL,
"pbc_ownr" char(129) NOT NULL,
"pbc_cnam" char(129) NOT NULL,
"pbc_cid" smallint NULL,
"pbc_labl" char(254) NULL,
"pbc_lpos" smallint NULL,
"pbc_hdr" char(254) NULL,
"pbc_hpos" smallint NULL,
"pbc_jtfy" smallint NULL,
"pbc_mask" char(31) NULL,
"pbc_case" smallint NULL,
"pbc_hght" smallint NULL,
"pbc_wdth" smallint NULL,
"pbc_ptrn" char(31) NULL,
"pbc_bmap" char(1) NULL,
"pbc_init" char(254) NULL,
"pbc_cmnt" char(254) NULL,
"pbc_edit" char(31) NULL,
"pbc_tag" char(254) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatcol" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatcol" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatfmt"
(
"pbf_name" char(30) NOT NULL,
"pbf_frmt" char(254) NULL,
"pbf_type" smallint NULL,
"pbf_cntr" integer NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatfmt" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatfmt" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatvld"
(
"pbv_name" char(30) NOT NULL,
"pbv_vald" char(254) NULL,
"pbv_type" smallint NULL,
"pbv_cntr" integer NULL,
"pbv_msg" char(254) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatvld" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatvld" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatedt"
(
"pbe_name" char(30) NOT NULL,
"pbe_edit" char(254) NULL,
"pbe_type" smallint NULL,
"pbe_cntr" integer NULL,
"pbe_seqn" smallint NOT NULL,
"pbe_flag" integer NULL,
"pbe_work" char(32) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatedt" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatedt" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."localidades"
(
"id_localidad" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_localidad")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."localidades" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."provincias"
(
"id_provincia" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_provincia")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."provincias" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_documentos"
(
"tipo_documento" char(1) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_documento")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_documentos" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_cuentas"
(
"tipo_cuenta" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_cuentas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_clientes"
(
"tipo_cliente" char(1) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_cliente")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_clientes" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."etapas"
(
"id_etapa" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_etapa")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."etapas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."empresas"
(
"id_empresa" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"fecha_ingreso" date NULL,
"id_provincia" char(3) NOT NULL,
"id_localidad" char(3) NOT NULL,
"calle" varchar(30) NULL,
"numero" varchar(15) NULL,
"telefono" varchar(15) NULL,
"observaciones" varchar(120) NULL,
PRIMARY KEY ("id_empresa")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."empresas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."estados"
(
"id_estado" char(3) NOT NULL,
"id_etapa" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
"orden" smallint NULL,
PRIMARY KEY ("id_estado")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."estados" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."cuentas"
(
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
"tipo_cuenta" char(2) NOT NULL,
"fecha_ingreso" date NULL,
"deuda_original" numeric(12,2) NULL,
"id_estado" char(3) NOT NULL,
"fecha_ult_modificacion" date NULL,
"deuda_actual" numeric(12,2) NULL,
"observaciones" varchar(120) NULL,
"referencia" varchar(15) NULL,
PRIMARY KEY ("id_empresa", "id_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."cuentas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."estados_historicos"
(
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
"id_estado" char(3) NOT NULL,
"fecha_modificacion" date NOT NULL,
"deuda" numeric(12,2) NULL,
"observaciones" varchar(120) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."estados_historicos" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."clientes_por_cuenta"
(
"id_cliente" integer NOT NULL,
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
PRIMARY KEY ("id_cliente", "id_empresa", "id_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."clientes_por_cuenta" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."opciones"
(
"id_opcion" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
PRIMARY KEY ("id_opcion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."opciones" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_aplicacion"
(
"tipo_aplicacion" char(1) NOT NULL,
"descripcion" varchar(60) NULL,
PRIMARY KEY ("tipo_aplicacion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_aplicacion" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."aplicaciones"
(
"id_aplicacion" char(3) NOT NULL,
"tipo_aplicacion" char(1) NULL,
"nombre_aplicacion" varchar(50) NULL,
"nombre_ejecutable" varchar(30) NULL,
"id_aplicacion_padre" char(3) NULL,
PRIMARY KEY ("id_aplicacion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."aplicaciones" TO "dbo"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."aplicaciones" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."opciones_por_aplicacion"
(
"id_aplicacion" char(3) NOT NULL,
"id_opcion" char(2) NOT NULL,
PRIMARY KEY ("id_aplicacion", "id_opcion")
)
go
Grant select, insert, delete, update, alter, references on "mgodoy"."opciones_por_aplicacion" TO "rcapra" WITH GRANT OPTION
go
CREATE TABLE "mgodoy"."permisos_tipos_usuarios"
(
"id_tipo_usuario" char(3) NOT NULL,
"id_aplicacion" char(3) NOT NULL,
"id_opcion" char(2) NOT NULL,
PRIMARY KEY ("id_tipo_usuario", "id_aplicacion", "id_opcion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."permisos_tipos_usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_usuarios"
(
"id_tipo_usuario" char(3) NOT NULL,
"nombre_tipo_usuario" varchar(50) NULL,
PRIMARY KEY ("id_tipo_usuario")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."usuarios"
(
"id_usuario" char(3) NOT NULL,
"id_tipo_usuario" char(3) NULL,
"login_usuario" varchar(8) NULL,
"palabra_clave" varchar(8) NULL,
"nombre_usuario" varchar(50) NULL,
PRIMARY KEY ("id_usuario")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."clientes"
(
"id_cliente" integer NOT NULL,
"tipo_cliente" char(1) NOT NULL,
"apellido" varchar(30) NULL,
"nombre" varchar(50) NULL,
"tipo_documento" char(1) NOT NULL,
"nro_documento" varchar(15) NULL,
"fecha_ingreso" date NULL,
"id_provincia" char(3) NOT NULL,
"id_localidad" char(3) NOT NULL,
"calle" varchar(30) NULL,
"numero" varchar(15) NULL,
"piso_depto" varchar(15) NULL,
"telefono_particular" varchar(15) NULL,
"telefono_laboral" varchar(15) NULL,
"observaciones" varchar(120) NULL,
PRIMARY KEY ("id_cliente")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."clientes" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."t_cuenta_por_empresa"
(
"id_empresa" char(3) NOT NULL,
"tipo_cuenta" char(2) NOT NULL,
PRIMARY KEY ("id_empresa", "tipo_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."t_cuenta_por_empresa" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "rcapra"."pbcattbl"
(
"pbt_tnam" char(129) NOT NULL,
"pbt_tid" integer NULL,
"pbt_ownr" char(129) NOT NULL,
"pbd_fhgt" smallint NULL,
"pbd_fwgt" smallint NULL,
"pbd_fitl" char(1) NULL,
"pbd_funl" char(1) NULL,
"pbd_fchr" smallint NULL,
"pbd_fptc" smallint NULL,
"pbd_ffce" char(18) NULL,
"pbh_fhgt" smallint NULL,
"pbh_fwgt" smallint NULL,
"pbh_fitl" char(1) NULL,
"pbh_funl" char(1) NULL,
"pbh_fchr" smallint NULL,
"pbh_fptc" smallint NULL,
"pbh_ffce" char(18) NULL,
"pbl_fhgt" smallint NULL,
"pbl_fwgt" smallint NULL,
"pbl_fitl" char(1) NULL,
"pbl_funl" char(1) NULL,
"pbl_fchr" smallint NULL,
"pbl_fptc" smallint NULL,
"pbl_ffce" char(18) NULL,
"pbt_cmnt" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcattbl" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatcol"
(
"pbc_tnam" char(129) NOT NULL,
"pbc_tid" integer NULL,
"pbc_ownr" char(129) NOT NULL,
"pbc_cnam" char(129) NOT NULL,
"pbc_cid" smallint NULL,
"pbc_labl" char(254) NULL,
"pbc_lpos" smallint NULL,
"pbc_hdr" char(254) NULL,
"pbc_hpos" smallint NULL,
"pbc_jtfy" smallint NULL,
"pbc_mask" char(31) NULL,
"pbc_case" smallint NULL,
"pbc_hght" smallint NULL,
"pbc_wdth" smallint NULL,
"pbc_ptrn" char(31) NULL,
"pbc_bmap" char(1) NULL,
"pbc_init" char(254) NULL,
"pbc_cmnt" char(254) NULL,
"pbc_edit" char(31) NULL,
"pbc_tag" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatcol" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatfmt"
(
"pbf_name" char(30) NOT NULL,
"pbf_frmt" char(254) NULL,
"pbf_type" smallint NULL,
"pbf_cntr" integer NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatfmt" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatvld"
(
"pbv_name" char(30) NOT NULL,
"pbv_vald" char(254) NULL,
"pbv_type" smallint NULL,
"pbv_cntr" integer NULL,
"pbv_msg" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatvld" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatedt"
(
"pbe_name" char(30) NOT NULL,
"pbe_edit" char(254) NULL,
"pbe_type" smallint NULL,
"pbe_cntr" integer NULL,
"pbe_seqn" smallint NOT NULL,
"pbe_flag" integer NULL,
"pbe_work" char(32) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatedt" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reload data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LOAD TABLE "mgodoy"."pbcattbl"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\170.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatcol"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\171.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatfmt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\172.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatvld"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\173.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatedt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\174.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."localidades"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\187.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."provincias"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\188.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_documentos"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\189.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_cuentas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\190.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_clientes"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\191.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."etapas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\192.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."empresas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\193.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."estados"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\195.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."cuentas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\196.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."estados_historicos"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\197.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."clientes_por_cuenta"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\198.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."opciones"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\199.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_aplicacion"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\200.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."aplicaciones"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\201.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."opciones_por_aplicacion"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\202.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."permisos_tipos_usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\203.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\204.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\205.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."clientes"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\206.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."t_cuenta_por_empresa"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\207.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcattbl"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\208.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatcol"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\209.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatfmt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\210.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatvld"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\211.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatedt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\212.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add foreign key definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CREATE UNIQUE INDEX "pbcatt_x" ON "mgodoy"."pbcattbl"
(
"pbt_tnam" ASC,
"pbt_ownr" ASC
)
Go
CREATE UNIQUE INDEX "pbcatc_x" ON "mgodoy"."pbcatcol"
(
"pbc_tnam" ASC,
"pbc_ownr" ASC,
"pbc_cnam" ASC
)
Go
CREATE UNIQUE INDEX "pbcatf_x" ON "mgodoy"."pbcatfmt"
(
"pbf_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcatv_x" ON "mgodoy"."pbcatvld"
(
"pbv_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcate_x" ON "mgodoy"."pbcatedt"
(
"pbe_name" ASC,
"pbe_seqn" ASC
)
Go
ALTER TABLE "mgodoy"."empresas"
ADD FOREIGN KEY "fk_empresas_relation__provinci" ("id_provincia")
REFERENCES "mgodoy"."provincias" ("id_provincia")
Go
ALTER TABLE "mgodoy"."empresas"
ADD FOREIGN KEY "fk_empresas_relation__localida" ("id_localidad")
REFERENCES "mgodoy"."localidades" ("id_localidad")
Go
ALTER TABLE "mgodoy"."estados"
ADD FOREIGN KEY "fk_estados_relation__etapas" ("id_etapa")
REFERENCES "mgodoy"."etapas" ("id_etapa")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_cuentas_p_empresas" ("id_empresa")
REFERENCES "mgodoy"."empresas" ("id_empresa")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_relation__estados" ("id_estado")
REFERENCES "mgodoy"."estados" ("id_estado")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_relation__tipos_de" ("tipo_cuenta")
REFERENCES "mgodoy"."tipos_de_cuentas" ("tipo_cuenta")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_rela_tcuentaempresa" ("id_empresa","tipo_cuenta")
REFERENCES "mgodoy"."t_cuenta_por_empresa" ("id_empresa","tipo_cuenta")
Go
ALTER TABLE "mgodoy"."estados_historicos"
ADD FOREIGN KEY "fk_estados__relation__estados" ("id_estado")
REFERENCES "mgodoy"."estados" ("id_estado")
Go
ALTER TABLE "mgodoy"."estados_historicos"
ADD FOREIGN KEY "fk_estados__relation__cuentas" ("id_empresa","id_cuenta")
REFERENCES "mgodoy"."cuentas" ("id_empresa","id_cuenta")
go
ALTER TABLE "mgodoy"."clientes_por_cuenta"
ADD FOREIGN KEY "fk_clientes_relation__cuentas" ("id_empresa","id_cuenta")
REFERENCES "mgodoy"."cuentas" ("id_empresa","id_cuenta")
go
ALTER TABLE "mgodoy"."aplicaciones"
ADD FOREIGN KEY "fk_aplicaci_ref_854_tipos_ap" ("tipo_aplicacion")
REFERENCES "mgodoy"."tipos_aplicacion" ("tipo_aplicacion")
go
ALTER TABLE "mgodoy"."opciones_por_aplicacion"
ADD FOREIGN KEY "fk_opciones_ref_1002_aplicaci" ("id_aplicacion")
REFERENCES "mgodoy"."aplicaciones" ("id_aplicacion")
go
ALTER TABLE "mgodoy"."opciones_por_aplicacion"
ADD FOREIGN KEY "fk_opciones_ref_1014_opciones" ("id_opcion")
REFERENCES "mgodoy"."opciones" ("id_opcion")
go
ALTER TABLE "mgodoy"."permisos_tipos_usuarios"
ADD FOREIGN KEY "fk_permisos_ref_975_tipos_us" ("id_tipo_usuario")
REFERENCES "mgodoy"."tipos_usuarios" ("id_tipo_usuario")
go
ALTER TABLE "mgodoy"."permisos_tipos_usuarios"
ADD FOREIGN KEY "fk_permisos_ref_873_opciones" ("id_aplicacion","id_opcion")
REFERENCES "mgodoy"."opciones_por_aplicacion" ("id_aplicacion","id_opcion")
go
ALTER TABLE "mgodoy"."usuarios"
ADD FOREIGN KEY "fk_usuarios_ref_896_tipos_us" ("id_tipo_usuario")
REFERENCES "mgodoy"."tipos_usuarios" ("id_tipo_usuario")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__provinci" ("id_provincia")
REFERENCES "mgodoy"."provincias" ("id_provincia")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__localida" ("id_localidad")
REFERENCES "mgodoy"."localidades" ("id_localidad")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation_tipos_de" ("tipo_documento")
REFERENCES "mgodoy"."tipos_de_documentos" ("tipo_documento")
go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__tipos_de" ("tipo_cliente")
REFERENCES "mgodoy"."tipos_de_clientes" ("tipo_cliente")
go
ALTER TABLE "mgodoy"."t_cuenta_por_empresa"
ADD FOREIGN KEY "fk_tipo_cue_ref_930_empresas" ("id_empresa")
REFERENCES "mgodoy"."empresas" ("id_empresa")
go
ALTER TABLE "mgodoy"."t_cuenta_por_empresa"
ADD FOREIGN KEY "fk_tipo_cue_ref_933_tipos_de" ("tipo_cuenta")
REFERENCES "mgodoy"."tipos_de_cuentas" ("tipo_cuenta")
Go
CREATE UNIQUE INDEX "pbcatt_x" ON "rcapra"."pbcattbl"
(
"pbt_tnam" ASC,
"pbt_ownr" ASC
)
Go
CREATE UNIQUE INDEX "pbcatc_x" ON "rcapra"."pbcatcol"
(
"pbc_tnam" ASC,
"pbc_ownr" ASC,
"pbc_cnam" ASC
)
Go
CREATE UNIQUE INDEX "pbcatf_x" ON "rcapra"."pbcatfmt"
(
"pbf_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcatv_x" ON "rcapra"."pbcatvld"
(
"pbv_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcate_x" ON "rcapra"."pbcatedt"
(
"pbe_name" ASC,
"pbe_seqn" ASC
)
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create views
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create user messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create procedures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
create procedure mgodoy.Obtener_Clientes_Cuenta(in @tipo_cliente char(1),in @id_empresa char(3),in @id_cuenta varchar(20))
Result(id_cliente integer, fecha_ingreso date, apellido varchar(30), nombre varchar(50), tipo_documento char(1), nro_documento varchar(15), id_provincia char(3), id_localidad char(3), calle varchar(30), numero varchar(15), piso_depto varchar(15), telefono_particular varchar(15), telefono_laboral varchar(15), observaciones varchar(120))
Begin
select clientes.id_cliente,
clientes.fecha_ingreso,
clientes.apellido,
clientes.nombre,
clientes.tipo_documento,
clientes.nro_documento,
clientes.id_provincia,
clientes.id_localidad,
clientes.calle,
clientes.numero,
clientes.piso_depto,
clientes.telefono_particular,
clientes.telefono_laboral,
clientes.observaciones
from clientes
,clientes_por_cuenta
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and((clientes.tipo_cliente=@tipo_cliente)
and(clientes_por_cuenta.id_empresa=@id_empresa)
and(clientes_por_cuenta.id_cuenta=@id_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_Clientes_Cuenta" TO "rcapra"
go
create procedure mgodoy.Obtener_t_cuenta_por_empresa(in @id_empresa char(3))
result(tipo_cuenta char(2),descripcion varchar(50))
begin
select a.tipo_cuenta,a.descripcion
from tipos_de_cuentas as a
,t_cuenta_por_empresa as b
where b.tipo_cuenta=a.tipo_cuenta
and b.id_empresa=@id_empresa order by
a.tipo_cuenta asc
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_t_cuenta_por_empresa" TO "rcapra"
go
create procedure mgodoy.ListarCuentasPorEmpresa(in @id_empresa char(3),in @tipo_cuenta varchar(2))
result(apellido varchar(30),nombre varchar(50),id_cuenta varchar(20),fecha_ingreso date,deuda_original decimal(12,2)) /* RESULT ( column-name,... ) */
begin
select clientes.apellido,
clientes.nombre,
cuentas.id_cuenta,
cuentas.fecha_ingreso,
cuentas.deuda_original
from clientes
,clientes_por_cuenta
,cuentas
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and(cuentas.id_empresa=clientes_por_cuenta.id_empresa)
and(cuentas.id_cuenta=clientes_por_cuenta.id_cuenta)
and((cuentas.id_empresa=@id_empresa)
and(cuentas.tipo_cuenta=@tipo_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."ListarCuentasPorEmpresa" TO "rcapra"
go
create procedure mgodoy.Listar_Titulares_Garantes(in @id_empresa char(3),in @tipo_cuenta varchar(2))
result("ltrim(clientes.apellido)+\x27, \x27+ltrim(clientes.nombre)" varchar(82),abreviatura varchar(5),id_cuenta varchar(20),fecha_ingreso date,deuda_original decimal(12,2))
begin
select ltrim(clientes.apellido)+', '+ltrim(clientes.nombre) as nombre,
tipos_de_clientes.abreviatura,
cuentas.id_cuenta,
cuentas.fecha_ingreso,
cuentas.deuda_original
from clientes,clientes_por_cuenta
,cuentas,tipos_de_clientes
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and(cuentas.id_empresa=clientes_por_cuenta.id_empresa)
and(cuentas.id_cuenta=clientes_por_cuenta.id_cuenta)
and(clientes.tipo_cliente=tipos_de_clientes.tipo_cliente)
and((cuentas.id_empresa=@id_empresa)
and(cuentas.tipo_cuenta=@tipo_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."Listar_Titulares_Garantes" TO "rcapra"
go
create procedure mgodoy.obtener_id_empresa /* parameters,... */
as
begin
declare @id_empresa varchar(3)
select convert(varchar(3),"max"(convert(integer,id_empresa))+1)
from empresas
/* return(@id_empresa)*/
end
go
create procedure mgodoy.Obtener_Datos_Cuenta(in @id_empresa char(3),in @id_cuenta varchar(20))
result(fecha_ingreso date,id_empresa char(3),id_cuenta varchar(20),tipo_cuenta char(2),deuda_original decimal(12,2),fecha_ult_modificacion date,id_estado char(3),deuda_actual decimal(12,2),observaciones varchar(120),id_etapa char(3),referencia varchar(15))
begin
select a.fecha_ingreso,a.id_empresa,a.id_cuenta,a.tipo_cuenta,
a.deuda_original,a.fecha_ult_modificacion,a.id_estado,
a.deuda_actual,a.observaciones,b.id_etapa,a.referencia
from cuentas as a,estados as b
where a.id_cuenta=@id_cuenta
and a.id_empresa=@id_empresa
and a.id_estado=b.id_estado
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_Datos_Cuenta" TO "rcapra"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create triggers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create SQL remote definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CREATE REMOTE TYPE "FILE" ADDRESS ''
go
CREATE REMOTE TYPE "MAPI" ADDRESS ''
go
CREATE REMOTE TYPE "VIM" ADDRESS ''
go
CREATE REMOTE TYPE "SMTP" ADDRESS ''
go
CREATE REMOTE TYPE "FTP" ADDRESS ''
Go
GRANT PUBLISH TO "mgodoy"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check view definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT CONNECT TO "mgodoy" IDENTIFIED BY ENCRYPTED '\xDB\x29\x9B\x44\x2E\x2C\xBB\x10\x63\x19\x00\x2C\x71\x6D\xD4\x23\x36\x58\x44\x3B\x5C\xC5\xF5\xCB\x9D\x80\x59\xA1\x7F\x80\xD8\xC9\xAE\xDC\xA8\x78'
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create integrated logins
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set option values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET OPTION Statistics =
go
SET OPTION Date_order =
go
%
%SQL Option Statements for user
%
SET OPTION "PUBLIC"."Blocking" = 'ON'
go
SET OPTION "PUBLIC"."Checkpoint_time" = '60'
go
SET OPTION "PUBLIC"."Conversion_error" = 'ON'
go
SET OPTION "PUBLIC"."Date_format" = 'YYYY-MM-DD'
go
SET OPTION "PUBLIC"."Date_order" = 'YMD'
go
SET OPTION "PUBLIC"."Isolation_level" = '0'
go
SET OPTION "PUBLIC"."Lock_rejected_rows" = 'OFF'
go
SET OPTION "PUBLIC"."Precision" = '30'
go
SET OPTION "PUBLIC"."Recovery_time" = '2'
go
SET OPTION "PUBLIC"."Replicate_all" = 'OFF'
go
SET OPTION "PUBLIC"."Row_counts" = 'OFF'
go
SET OPTION "PUBLIC"."Scale" = '6'
go
SET OPTION "PUBLIC"."Thread_count" = '0'
go
SET OPTION "PUBLIC"."Thread_stack" = '750'
go
SET OPTION "PUBLIC"."Thread_swaps" = '18'
go
SET OPTION "PUBLIC"."Timestamp_format" = 'YYYY-MM-DD HH:NN:SS.SSS'
go
SET OPTION "PUBLIC"."Time_format" = 'HH:NN:SS.SSS'
go
SET OPTION "PUBLIC"."Wait_for_commit" = 'OFF'
go
SET OPTION "PUBLIC"."Quoted_identifier" = 'ON'
go
SET OPTION "PUBLIC"."Allow_nulls_by_default" = 'ON'
go
SET OPTION "PUBLIC"."Automatic_timestamp" = 'OFF'
go
SET OPTION "PUBLIC"."Query_plan_on_open" = 'OFF'
go
SET OPTION "PUBLIC"."Cooperative_commits" = 'ON'
go
SET OPTION "PUBLIC"."Cooperative_commit_timeout" = '250'
go
SET OPTION "PUBLIC"."Delayed_commits" = 'OFF'
go
SET OPTION "PUBLIC"."Delayed_commit_timeout" = '500'
go
SET OPTION "PUBLIC"."Non_keywords" = ''
go
SET OPTION "PUBLIC"."SQL_flagger_error_level" = 'W'
go
SET OPTION "PUBLIC"."SQL_flagger_warning_level" = 'W'
go
SET OPTION "PUBLIC"."Ansi_blanks" = 'OFF'
go
SET OPTION "PUBLIC"."Ansi_integer_overflow" = 'OFF'
go
SET OPTION "PUBLIC"."String_rtruncation" = 'OFF'
go
SET OPTION "PUBLIC"."Divide_by_zero_error" = 'ON'
go
SET OPTION "PUBLIC"."Ansinull" = 'ON'
go
SET OPTION "PUBLIC"."Ansi_permissions" = 'ON'
go
SET OPTION "PUBLIC"."Close_on_endtrans" = 'ON'
go
SET OPTION "PUBLIC"."Tsql_variables" = 'OFF'
go
SET OPTION "PUBLIC"."RI_Trigger_time" = 'AFTER'
go
SET OPTION "PUBLIC"."Tsql_hex_constant" = 'ON'
go
SET OPTION "PUBLIC"."Chained" = 'ON'
go
SET OPTION "PUBLIC"."Nearest_century" = '0'
go
SET OPTION "PUBLIC"."Fire_triggers" = 'ON'
go
SET OPTION "PUBLIC"."Background_priority" = 'OFF'
go
SET OPTION "PUBLIC"."Login_mode" = 'Standard'
go
SET OPTION "PUBLIC"."Float_as_double" = 'OFF'
go
SET OPTION "PUBLIC"."Default_timestamp_increment" = '1'
go
SET OPTION "PUBLIC"."Escape_character" = 'ON'
go
SET OPTION "PUBLIC"."Continue_after_raiserror" = 'OFF'
go
SET OPTION "PUBLIC"."Auto_commit" = 'OFF'
go
SET OPTION "PUBLIC"."Auto_refetch" = 'ON'
go
SET OPTION "PUBLIC"."Bell" = 'ON'
go
SET OPTION "PUBLIC"."Command_delimiter" = ';'
go
SET OPTION "PUBLIC"."Commit_on_exit" = 'ON'
go
SET OPTION "PUBLIC"."Echo" = 'ON'
go
SET OPTION "PUBLIC"."Headings" = 'On'
go
SET OPTION "PUBLIC"."Input_format" = 'ASCII'
go
SET OPTION "PUBLIC"."ISQL_log" = ''
go
SET OPTION "PUBLIC"."NULLS" = '(NULL)'
go
SET OPTION "PUBLIC"."On_error" = 'PROMPT'
go
SET OPTION "PUBLIC"."Output_format" = 'ASCII'
go
SET OPTION "PUBLIC"."Output_length" = '0'
go
SET OPTION "PUBLIC"."Output_nulls" = ''
go
SET OPTION "PUBLIC"."Quiet" = 'OFF'
go
SET OPTION "PUBLIC"."Screen_format" = 'TEXT'
go
SET OPTION "PUBLIC"."SQLConnect" = ''
go
SET OPTION "PUBLIC"."SQLStart" = ''
go
SET OPTION "PUBLIC"."Statistics" = '3'
go
SET OPTION "PUBLIC"."Truncation_length" = '30'
go
SET OPTION "PUBLIC"."Verify_all_columns" = 'Off'
go
SET OPTION "PUBLIC"."Delete_old_logs" = 'Off'
go
SET OPTION "PUBLIC"."Qualify_owners" = 'On'
go
SET OPTION "PUBLIC"."Quote_all_identifiers" = 'Off'
go
SET OPTION "PUBLIC"."Replication_error" = ''
go
SET OPTION "PUBLIC"."Subscribe_by_remote" = 'On'
go
SET OPTION "PUBLIC"."Verify_threshold" = '1000'
Go
Commit work
Go
Te paso un scrip con un ejemplo en la creación de tablas, pero te conviene crear la base de datos a través de la aplicación "Sybase Central" que viene con el anyware. Con ella podes crear la base de datos, usuarios, grupos, tablas, procedimientos, y asignar permisos. Es muy simple de usar. Por otro lado para armar el modelo de datos es muy bueno el powerdesigner, también es una herramienta de sybase y la misma te genera todo el código para que crees las tablas, llaves foranes y primarias, etc.
Te paso algo de código donde tenés de todo un poco, creación de usarios, tablas procedimientos, etc. Cualquier duda no dudes en consultarme
Saludos y Feliza Navidad.
Miguel
% Usage: isql read F:\MODELOS\DB_JUDIC\RELOAD.SQL
%
% This command file reloads a database that was unloaded using "dbunload".
%
% (Version: 5.5.04 Build #1867)
%
SET OPTION Statistics = 3
go
SET OPTION Date_order = 'YMD'
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create userids and grant user permissions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT CONNECT TO "DBA" IDENTIFIED BY ENCRYPTED '\x6E\x27\xE3\x58\x69\x8C\x6C\x2B\x63\x45\x3A\xC9\x01\x3F\x40\x01\x03\xF1\x31\x0E\x8D\x1C\x57\x45\x4A\xC9\xCE\x42\x4B\xAC\x93\x6F\xBC\xFE\xA6\xD3'
Go
Grant resource, dba, schedule to "dba"
Go
GRANT CONNECT TO "dbo"
Go
GRANT GROUP TO "dbo"
Go
Grant resource, dba to "dbo"
Go
GRANT CONNECT TO "mgodoy" IDENTIFIED BY "SQL"
Go
GRANT DBA, REMOTE DBA TO "mgodoy"
Go
GRANT CONNECT TO "rcapra" IDENTIFIED BY ENCRYPTED '\x08\x35\xBC\x7C\x2D\xC9\x62\x2E\x44\x18\xF8\x7D\x03\x65\x89\x96\xD4\xDE\x44\x30\x1D\x3D\xCE\x39\x89\xE8\xFC\xD7\x8B\x36\x6A\xA7\x7F\x50\xC9\x01'
Go
GRANT RESOURCE, DBA, REMOTE DBA TO "rcapra"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create user-defined types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE DOMAIN T_money numeric(19,4)
Go
CREATE DOMAIN T_smallmoney numeric(10,4)
Go
CREATE DOMAIN T_datetime timestamp
Go
CREATE DOMAIN T_smalldatetime timestamp
Go
CREATE DOMAIN T_text long varchar
go
CREATE DOMAIN T_image long binary
go
CREATE DOMAIN T_bit tinyint NOT NULL
go
CREATE DOMAIN T_sysname varchar(30) NOT NULL
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT MEMBERSHIP IN GROUP "dbo" TO "DBA"
go
GRANT MEMBERSHIP IN GROUP "dbo" TO "mgodoy"
go
GRANT MEMBERSHIP IN GROUP "dbo" TO "rcapra"
Go
CREATE TABLE "mgodoy"."pbcattbl"
(
"pbt_tnam" char(129) NOT NULL,
"pbt_tid" integer NULL,
"pbt_ownr" char(129) NOT NULL,
"pbd_fhgt" smallint NULL,
"pbd_fwgt" smallint NULL,
"pbd_fitl" char(1) NULL,
"pbd_funl" char(1) NULL,
"pbd_fchr" smallint NULL,
"pbd_fptc" smallint NULL,
"pbd_ffce" char(18) NULL,
"pbh_fhgt" smallint NULL,
"pbh_fwgt" smallint NULL,
"pbh_fitl" char(1) NULL,
"pbh_funl" char(1) NULL,
"pbh_fchr" smallint NULL,
"pbh_fptc" smallint NULL,
"pbh_ffce" char(18) NULL,
"pbl_fhgt" smallint NULL,
"pbl_fwgt" smallint NULL,
"pbl_fitl" char(1) NULL,
"pbl_funl" char(1) NULL,
"pbl_fchr" smallint NULL,
"pbl_fptc" smallint NULL,
"pbl_ffce" char(18) NULL,
"pbt_cmnt" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcattbl" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcattbl" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatcol"
(
"pbc_tnam" char(129) NOT NULL,
"pbc_tid" integer NULL,
"pbc_ownr" char(129) NOT NULL,
"pbc_cnam" char(129) NOT NULL,
"pbc_cid" smallint NULL,
"pbc_labl" char(254) NULL,
"pbc_lpos" smallint NULL,
"pbc_hdr" char(254) NULL,
"pbc_hpos" smallint NULL,
"pbc_jtfy" smallint NULL,
"pbc_mask" char(31) NULL,
"pbc_case" smallint NULL,
"pbc_hght" smallint NULL,
"pbc_wdth" smallint NULL,
"pbc_ptrn" char(31) NULL,
"pbc_bmap" char(1) NULL,
"pbc_init" char(254) NULL,
"pbc_cmnt" char(254) NULL,
"pbc_edit" char(31) NULL,
"pbc_tag" char(254) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatcol" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatcol" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatfmt"
(
"pbf_name" char(30) NOT NULL,
"pbf_frmt" char(254) NULL,
"pbf_type" smallint NULL,
"pbf_cntr" integer NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatfmt" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatfmt" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatvld"
(
"pbv_name" char(30) NOT NULL,
"pbv_vald" char(254) NULL,
"pbv_type" smallint NULL,
"pbv_cntr" integer NULL,
"pbv_msg" char(254) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatvld" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatvld" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."pbcatedt"
(
"pbe_name" char(30) NOT NULL,
"pbe_edit" char(254) NULL,
"pbe_type" smallint NULL,
"pbe_cntr" integer NULL,
"pbe_seqn" smallint NOT NULL,
"pbe_flag" integer NULL,
"pbe_work" char(32) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatedt" TO "PUBLIC"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."pbcatedt" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."localidades"
(
"id_localidad" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_localidad")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."localidades" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."provincias"
(
"id_provincia" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_provincia")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."provincias" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_documentos"
(
"tipo_documento" char(1) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_documento")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_documentos" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_cuentas"
(
"tipo_cuenta" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_cuentas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_de_clientes"
(
"tipo_cliente" char(1) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("tipo_cliente")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_de_clientes" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."etapas"
(
"id_etapa" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
PRIMARY KEY ("id_etapa")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."etapas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."empresas"
(
"id_empresa" char(3) NOT NULL,
"nombre" varchar(50) NULL,
"fecha_ingreso" date NULL,
"id_provincia" char(3) NOT NULL,
"id_localidad" char(3) NOT NULL,
"calle" varchar(30) NULL,
"numero" varchar(15) NULL,
"telefono" varchar(15) NULL,
"observaciones" varchar(120) NULL,
PRIMARY KEY ("id_empresa")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."empresas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."estados"
(
"id_estado" char(3) NOT NULL,
"id_etapa" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
"abreviatura" varchar(5) NULL,
"orden" smallint NULL,
PRIMARY KEY ("id_estado")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."estados" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."cuentas"
(
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
"tipo_cuenta" char(2) NOT NULL,
"fecha_ingreso" date NULL,
"deuda_original" numeric(12,2) NULL,
"id_estado" char(3) NOT NULL,
"fecha_ult_modificacion" date NULL,
"deuda_actual" numeric(12,2) NULL,
"observaciones" varchar(120) NULL,
"referencia" varchar(15) NULL,
PRIMARY KEY ("id_empresa", "id_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."cuentas" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."estados_historicos"
(
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
"id_estado" char(3) NOT NULL,
"fecha_modificacion" date NOT NULL,
"deuda" numeric(12,2) NULL,
"observaciones" varchar(120) NULL
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."estados_historicos" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."clientes_por_cuenta"
(
"id_cliente" integer NOT NULL,
"id_empresa" char(3) NOT NULL,
"id_cuenta" varchar(20) NOT NULL,
PRIMARY KEY ("id_cliente", "id_empresa", "id_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."clientes_por_cuenta" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."opciones"
(
"id_opcion" char(2) NOT NULL,
"descripcion" varchar(50) NULL,
PRIMARY KEY ("id_opcion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."opciones" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_aplicacion"
(
"tipo_aplicacion" char(1) NOT NULL,
"descripcion" varchar(60) NULL,
PRIMARY KEY ("tipo_aplicacion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_aplicacion" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."aplicaciones"
(
"id_aplicacion" char(3) NOT NULL,
"tipo_aplicacion" char(1) NULL,
"nombre_aplicacion" varchar(50) NULL,
"nombre_ejecutable" varchar(30) NULL,
"id_aplicacion_padre" char(3) NULL,
PRIMARY KEY ("id_aplicacion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."aplicaciones" TO "dbo"
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."aplicaciones" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."opciones_por_aplicacion"
(
"id_aplicacion" char(3) NOT NULL,
"id_opcion" char(2) NOT NULL,
PRIMARY KEY ("id_aplicacion", "id_opcion")
)
go
Grant select, insert, delete, update, alter, references on "mgodoy"."opciones_por_aplicacion" TO "rcapra" WITH GRANT OPTION
go
CREATE TABLE "mgodoy"."permisos_tipos_usuarios"
(
"id_tipo_usuario" char(3) NOT NULL,
"id_aplicacion" char(3) NOT NULL,
"id_opcion" char(2) NOT NULL,
PRIMARY KEY ("id_tipo_usuario", "id_aplicacion", "id_opcion")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."permisos_tipos_usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."tipos_usuarios"
(
"id_tipo_usuario" char(3) NOT NULL,
"nombre_tipo_usuario" varchar(50) NULL,
PRIMARY KEY ("id_tipo_usuario")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."tipos_usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."usuarios"
(
"id_usuario" char(3) NOT NULL,
"id_tipo_usuario" char(3) NULL,
"login_usuario" varchar(8) NULL,
"palabra_clave" varchar(8) NULL,
"nombre_usuario" varchar(50) NULL,
PRIMARY KEY ("id_usuario")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."usuarios" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."clientes"
(
"id_cliente" integer NOT NULL,
"tipo_cliente" char(1) NOT NULL,
"apellido" varchar(30) NULL,
"nombre" varchar(50) NULL,
"tipo_documento" char(1) NOT NULL,
"nro_documento" varchar(15) NULL,
"fecha_ingreso" date NULL,
"id_provincia" char(3) NOT NULL,
"id_localidad" char(3) NOT NULL,
"calle" varchar(30) NULL,
"numero" varchar(15) NULL,
"piso_depto" varchar(15) NULL,
"telefono_particular" varchar(15) NULL,
"telefono_laboral" varchar(15) NULL,
"observaciones" varchar(120) NULL,
PRIMARY KEY ("id_cliente")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."clientes" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "mgodoy"."t_cuenta_por_empresa"
(
"id_empresa" char(3) NOT NULL,
"tipo_cuenta" char(2) NOT NULL,
PRIMARY KEY ("id_empresa", "tipo_cuenta")
)
Go
Grant select, insert, delete, update, alter, references on "mgodoy"."t_cuenta_por_empresa" TO "rcapra" WITH GRANT OPTION
Go
CREATE TABLE "rcapra"."pbcattbl"
(
"pbt_tnam" char(129) NOT NULL,
"pbt_tid" integer NULL,
"pbt_ownr" char(129) NOT NULL,
"pbd_fhgt" smallint NULL,
"pbd_fwgt" smallint NULL,
"pbd_fitl" char(1) NULL,
"pbd_funl" char(1) NULL,
"pbd_fchr" smallint NULL,
"pbd_fptc" smallint NULL,
"pbd_ffce" char(18) NULL,
"pbh_fhgt" smallint NULL,
"pbh_fwgt" smallint NULL,
"pbh_fitl" char(1) NULL,
"pbh_funl" char(1) NULL,
"pbh_fchr" smallint NULL,
"pbh_fptc" smallint NULL,
"pbh_ffce" char(18) NULL,
"pbl_fhgt" smallint NULL,
"pbl_fwgt" smallint NULL,
"pbl_fitl" char(1) NULL,
"pbl_funl" char(1) NULL,
"pbl_fchr" smallint NULL,
"pbl_fptc" smallint NULL,
"pbl_ffce" char(18) NULL,
"pbt_cmnt" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcattbl" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatcol"
(
"pbc_tnam" char(129) NOT NULL,
"pbc_tid" integer NULL,
"pbc_ownr" char(129) NOT NULL,
"pbc_cnam" char(129) NOT NULL,
"pbc_cid" smallint NULL,
"pbc_labl" char(254) NULL,
"pbc_lpos" smallint NULL,
"pbc_hdr" char(254) NULL,
"pbc_hpos" smallint NULL,
"pbc_jtfy" smallint NULL,
"pbc_mask" char(31) NULL,
"pbc_case" smallint NULL,
"pbc_hght" smallint NULL,
"pbc_wdth" smallint NULL,
"pbc_ptrn" char(31) NULL,
"pbc_bmap" char(1) NULL,
"pbc_init" char(254) NULL,
"pbc_cmnt" char(254) NULL,
"pbc_edit" char(31) NULL,
"pbc_tag" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatcol" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatfmt"
(
"pbf_name" char(30) NOT NULL,
"pbf_frmt" char(254) NULL,
"pbf_type" smallint NULL,
"pbf_cntr" integer NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatfmt" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatvld"
(
"pbv_name" char(30) NOT NULL,
"pbv_vald" char(254) NULL,
"pbv_type" smallint NULL,
"pbv_cntr" integer NULL,
"pbv_msg" char(254) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatvld" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CREATE TABLE "rcapra"."pbcatedt"
(
"pbe_name" char(30) NOT NULL,
"pbe_edit" char(254) NULL,
"pbe_type" smallint NULL,
"pbe_cntr" integer NULL,
"pbe_seqn" smallint NOT NULL,
"pbe_flag" integer NULL,
"pbe_work" char(32) NULL
)
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
CONNECT "rcapra"
Go
Grant select, insert, delete, update, alter, references on "rcapra"."pbcatedt" TO "PUBLIC"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reload data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LOAD TABLE "mgodoy"."pbcattbl"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\170.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatcol"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\171.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatfmt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\172.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatvld"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\173.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."pbcatedt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\174.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."localidades"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\187.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."provincias"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\188.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_documentos"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\189.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_cuentas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\190.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_de_clientes"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\191.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."etapas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\192.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."empresas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\193.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."estados"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\195.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."cuentas"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\196.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."estados_historicos"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\197.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."clientes_por_cuenta"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\198.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."opciones"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\199.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_aplicacion"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\200.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."aplicaciones"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\201.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."opciones_por_aplicacion"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\202.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."permisos_tipos_usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\203.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."tipos_usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\204.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."usuarios"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\205.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."clientes"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\206.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "mgodoy"."t_cuenta_por_empresa"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\207.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcattbl"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\208.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatcol"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\209.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatfmt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\210.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatvld"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\211.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
LOAD TABLE "rcapra"."pbcatedt"
FROM 'F:\\MODELOS\\DB_JUDIC\\UNLOAD\\212.dat'
Format 'ascii'
Quotes on escapes on strip off
DELIMITED BY ','
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add foreign key definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CREATE UNIQUE INDEX "pbcatt_x" ON "mgodoy"."pbcattbl"
(
"pbt_tnam" ASC,
"pbt_ownr" ASC
)
Go
CREATE UNIQUE INDEX "pbcatc_x" ON "mgodoy"."pbcatcol"
(
"pbc_tnam" ASC,
"pbc_ownr" ASC,
"pbc_cnam" ASC
)
Go
CREATE UNIQUE INDEX "pbcatf_x" ON "mgodoy"."pbcatfmt"
(
"pbf_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcatv_x" ON "mgodoy"."pbcatvld"
(
"pbv_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcate_x" ON "mgodoy"."pbcatedt"
(
"pbe_name" ASC,
"pbe_seqn" ASC
)
Go
ALTER TABLE "mgodoy"."empresas"
ADD FOREIGN KEY "fk_empresas_relation__provinci" ("id_provincia")
REFERENCES "mgodoy"."provincias" ("id_provincia")
Go
ALTER TABLE "mgodoy"."empresas"
ADD FOREIGN KEY "fk_empresas_relation__localida" ("id_localidad")
REFERENCES "mgodoy"."localidades" ("id_localidad")
Go
ALTER TABLE "mgodoy"."estados"
ADD FOREIGN KEY "fk_estados_relation__etapas" ("id_etapa")
REFERENCES "mgodoy"."etapas" ("id_etapa")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_cuentas_p_empresas" ("id_empresa")
REFERENCES "mgodoy"."empresas" ("id_empresa")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_relation__estados" ("id_estado")
REFERENCES "mgodoy"."estados" ("id_estado")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_relation__tipos_de" ("tipo_cuenta")
REFERENCES "mgodoy"."tipos_de_cuentas" ("tipo_cuenta")
Go
ALTER TABLE "mgodoy"."cuentas"
ADD FOREIGN KEY "fk_cuentas_rela_tcuentaempresa" ("id_empresa","tipo_cuenta")
REFERENCES "mgodoy"."t_cuenta_por_empresa" ("id_empresa","tipo_cuenta")
Go
ALTER TABLE "mgodoy"."estados_historicos"
ADD FOREIGN KEY "fk_estados__relation__estados" ("id_estado")
REFERENCES "mgodoy"."estados" ("id_estado")
Go
ALTER TABLE "mgodoy"."estados_historicos"
ADD FOREIGN KEY "fk_estados__relation__cuentas" ("id_empresa","id_cuenta")
REFERENCES "mgodoy"."cuentas" ("id_empresa","id_cuenta")
go
ALTER TABLE "mgodoy"."clientes_por_cuenta"
ADD FOREIGN KEY "fk_clientes_relation__cuentas" ("id_empresa","id_cuenta")
REFERENCES "mgodoy"."cuentas" ("id_empresa","id_cuenta")
go
ALTER TABLE "mgodoy"."aplicaciones"
ADD FOREIGN KEY "fk_aplicaci_ref_854_tipos_ap" ("tipo_aplicacion")
REFERENCES "mgodoy"."tipos_aplicacion" ("tipo_aplicacion")
go
ALTER TABLE "mgodoy"."opciones_por_aplicacion"
ADD FOREIGN KEY "fk_opciones_ref_1002_aplicaci" ("id_aplicacion")
REFERENCES "mgodoy"."aplicaciones" ("id_aplicacion")
go
ALTER TABLE "mgodoy"."opciones_por_aplicacion"
ADD FOREIGN KEY "fk_opciones_ref_1014_opciones" ("id_opcion")
REFERENCES "mgodoy"."opciones" ("id_opcion")
go
ALTER TABLE "mgodoy"."permisos_tipos_usuarios"
ADD FOREIGN KEY "fk_permisos_ref_975_tipos_us" ("id_tipo_usuario")
REFERENCES "mgodoy"."tipos_usuarios" ("id_tipo_usuario")
go
ALTER TABLE "mgodoy"."permisos_tipos_usuarios"
ADD FOREIGN KEY "fk_permisos_ref_873_opciones" ("id_aplicacion","id_opcion")
REFERENCES "mgodoy"."opciones_por_aplicacion" ("id_aplicacion","id_opcion")
go
ALTER TABLE "mgodoy"."usuarios"
ADD FOREIGN KEY "fk_usuarios_ref_896_tipos_us" ("id_tipo_usuario")
REFERENCES "mgodoy"."tipos_usuarios" ("id_tipo_usuario")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__provinci" ("id_provincia")
REFERENCES "mgodoy"."provincias" ("id_provincia")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__localida" ("id_localidad")
REFERENCES "mgodoy"."localidades" ("id_localidad")
Go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation_tipos_de" ("tipo_documento")
REFERENCES "mgodoy"."tipos_de_documentos" ("tipo_documento")
go
ALTER TABLE "mgodoy"."clientes"
ADD FOREIGN KEY "fk_clientes_relation__tipos_de" ("tipo_cliente")
REFERENCES "mgodoy"."tipos_de_clientes" ("tipo_cliente")
go
ALTER TABLE "mgodoy"."t_cuenta_por_empresa"
ADD FOREIGN KEY "fk_tipo_cue_ref_930_empresas" ("id_empresa")
REFERENCES "mgodoy"."empresas" ("id_empresa")
go
ALTER TABLE "mgodoy"."t_cuenta_por_empresa"
ADD FOREIGN KEY "fk_tipo_cue_ref_933_tipos_de" ("tipo_cuenta")
REFERENCES "mgodoy"."tipos_de_cuentas" ("tipo_cuenta")
Go
CREATE UNIQUE INDEX "pbcatt_x" ON "rcapra"."pbcattbl"
(
"pbt_tnam" ASC,
"pbt_ownr" ASC
)
Go
CREATE UNIQUE INDEX "pbcatc_x" ON "rcapra"."pbcatcol"
(
"pbc_tnam" ASC,
"pbc_ownr" ASC,
"pbc_cnam" ASC
)
Go
CREATE UNIQUE INDEX "pbcatf_x" ON "rcapra"."pbcatfmt"
(
"pbf_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcatv_x" ON "rcapra"."pbcatvld"
(
"pbv_name" ASC
)
Go
CREATE UNIQUE INDEX "pbcate_x" ON "rcapra"."pbcatedt"
(
"pbe_name" ASC,
"pbe_seqn" ASC
)
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create views
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create user messages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create procedures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
create procedure mgodoy.Obtener_Clientes_Cuenta(in @tipo_cliente char(1),in @id_empresa char(3),in @id_cuenta varchar(20))
Result(id_cliente integer, fecha_ingreso date, apellido varchar(30), nombre varchar(50), tipo_documento char(1), nro_documento varchar(15), id_provincia char(3), id_localidad char(3), calle varchar(30), numero varchar(15), piso_depto varchar(15), telefono_particular varchar(15), telefono_laboral varchar(15), observaciones varchar(120))
Begin
select clientes.id_cliente,
clientes.fecha_ingreso,
clientes.apellido,
clientes.nombre,
clientes.tipo_documento,
clientes.nro_documento,
clientes.id_provincia,
clientes.id_localidad,
clientes.calle,
clientes.numero,
clientes.piso_depto,
clientes.telefono_particular,
clientes.telefono_laboral,
clientes.observaciones
from clientes
,clientes_por_cuenta
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and((clientes.tipo_cliente=@tipo_cliente)
and(clientes_por_cuenta.id_empresa=@id_empresa)
and(clientes_por_cuenta.id_cuenta=@id_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_Clientes_Cuenta" TO "rcapra"
go
create procedure mgodoy.Obtener_t_cuenta_por_empresa(in @id_empresa char(3))
result(tipo_cuenta char(2),descripcion varchar(50))
begin
select a.tipo_cuenta,a.descripcion
from tipos_de_cuentas as a
,t_cuenta_por_empresa as b
where b.tipo_cuenta=a.tipo_cuenta
and b.id_empresa=@id_empresa order by
a.tipo_cuenta asc
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_t_cuenta_por_empresa" TO "rcapra"
go
create procedure mgodoy.ListarCuentasPorEmpresa(in @id_empresa char(3),in @tipo_cuenta varchar(2))
result(apellido varchar(30),nombre varchar(50),id_cuenta varchar(20),fecha_ingreso date,deuda_original decimal(12,2)) /* RESULT ( column-name,... ) */
begin
select clientes.apellido,
clientes.nombre,
cuentas.id_cuenta,
cuentas.fecha_ingreso,
cuentas.deuda_original
from clientes
,clientes_por_cuenta
,cuentas
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and(cuentas.id_empresa=clientes_por_cuenta.id_empresa)
and(cuentas.id_cuenta=clientes_por_cuenta.id_cuenta)
and((cuentas.id_empresa=@id_empresa)
and(cuentas.tipo_cuenta=@tipo_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."ListarCuentasPorEmpresa" TO "rcapra"
go
create procedure mgodoy.Listar_Titulares_Garantes(in @id_empresa char(3),in @tipo_cuenta varchar(2))
result("ltrim(clientes.apellido)+\x27, \x27+ltrim(clientes.nombre)" varchar(82),abreviatura varchar(5),id_cuenta varchar(20),fecha_ingreso date,deuda_original decimal(12,2))
begin
select ltrim(clientes.apellido)+', '+ltrim(clientes.nombre) as nombre,
tipos_de_clientes.abreviatura,
cuentas.id_cuenta,
cuentas.fecha_ingreso,
cuentas.deuda_original
from clientes,clientes_por_cuenta
,cuentas,tipos_de_clientes
where(clientes.id_cliente=clientes_por_cuenta.id_cliente)
and(cuentas.id_empresa=clientes_por_cuenta.id_empresa)
and(cuentas.id_cuenta=clientes_por_cuenta.id_cuenta)
and(clientes.tipo_cliente=tipos_de_clientes.tipo_cliente)
and((cuentas.id_empresa=@id_empresa)
and(cuentas.tipo_cuenta=@tipo_cuenta))
end
go
GRANT EXECUTE ON "mgodoy"."Listar_Titulares_Garantes" TO "rcapra"
go
create procedure mgodoy.obtener_id_empresa /* parameters,... */
as
begin
declare @id_empresa varchar(3)
select convert(varchar(3),"max"(convert(integer,id_empresa))+1)
from empresas
/* return(@id_empresa)*/
end
go
create procedure mgodoy.Obtener_Datos_Cuenta(in @id_empresa char(3),in @id_cuenta varchar(20))
result(fecha_ingreso date,id_empresa char(3),id_cuenta varchar(20),tipo_cuenta char(2),deuda_original decimal(12,2),fecha_ult_modificacion date,id_estado char(3),deuda_actual decimal(12,2),observaciones varchar(120),id_etapa char(3),referencia varchar(15))
begin
select a.fecha_ingreso,a.id_empresa,a.id_cuenta,a.tipo_cuenta,
a.deuda_original,a.fecha_ult_modificacion,a.id_estado,
a.deuda_actual,a.observaciones,b.id_etapa,a.referencia
from cuentas as a,estados as b
where a.id_cuenta=@id_cuenta
and a.id_empresa=@id_empresa
and a.id_estado=b.id_estado
end
go
GRANT EXECUTE ON "mgodoy"."Obtener_Datos_Cuenta" TO "rcapra"
Go
CONNECT "mgodoy" IDENTIFIED BY "SQL"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create triggers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create SQL remote definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CREATE REMOTE TYPE "FILE" ADDRESS ''
go
CREATE REMOTE TYPE "MAPI" ADDRESS ''
go
CREATE REMOTE TYPE "VIM" ADDRESS ''
go
CREATE REMOTE TYPE "SMTP" ADDRESS ''
go
CREATE REMOTE TYPE "FTP" ADDRESS ''
Go
GRANT PUBLISH TO "mgodoy"
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check view definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GRANT CONNECT TO "mgodoy" IDENTIFIED BY ENCRYPTED '\xDB\x29\x9B\x44\x2E\x2C\xBB\x10\x63\x19\x00\x2C\x71\x6D\xD4\x23\x36\x58\x44\x3B\x5C\xC5\xF5\xCB\x9D\x80\x59\xA1\x7F\x80\xD8\xC9\xAE\xDC\xA8\x78'
Go
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create integrated logins
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Commit work
Go
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set option values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET OPTION Statistics =
go
SET OPTION Date_order =
go
%
%SQL Option Statements for user
%
SET OPTION "PUBLIC"."Blocking" = 'ON'
go
SET OPTION "PUBLIC"."Checkpoint_time" = '60'
go
SET OPTION "PUBLIC"."Conversion_error" = 'ON'
go
SET OPTION "PUBLIC"."Date_format" = 'YYYY-MM-DD'
go
SET OPTION "PUBLIC"."Date_order" = 'YMD'
go
SET OPTION "PUBLIC"."Isolation_level" = '0'
go
SET OPTION "PUBLIC"."Lock_rejected_rows" = 'OFF'
go
SET OPTION "PUBLIC"."Precision" = '30'
go
SET OPTION "PUBLIC"."Recovery_time" = '2'
go
SET OPTION "PUBLIC"."Replicate_all" = 'OFF'
go
SET OPTION "PUBLIC"."Row_counts" = 'OFF'
go
SET OPTION "PUBLIC"."Scale" = '6'
go
SET OPTION "PUBLIC"."Thread_count" = '0'
go
SET OPTION "PUBLIC"."Thread_stack" = '750'
go
SET OPTION "PUBLIC"."Thread_swaps" = '18'
go
SET OPTION "PUBLIC"."Timestamp_format" = 'YYYY-MM-DD HH:NN:SS.SSS'
go
SET OPTION "PUBLIC"."Time_format" = 'HH:NN:SS.SSS'
go
SET OPTION "PUBLIC"."Wait_for_commit" = 'OFF'
go
SET OPTION "PUBLIC"."Quoted_identifier" = 'ON'
go
SET OPTION "PUBLIC"."Allow_nulls_by_default" = 'ON'
go
SET OPTION "PUBLIC"."Automatic_timestamp" = 'OFF'
go
SET OPTION "PUBLIC"."Query_plan_on_open" = 'OFF'
go
SET OPTION "PUBLIC"."Cooperative_commits" = 'ON'
go
SET OPTION "PUBLIC"."Cooperative_commit_timeout" = '250'
go
SET OPTION "PUBLIC"."Delayed_commits" = 'OFF'
go
SET OPTION "PUBLIC"."Delayed_commit_timeout" = '500'
go
SET OPTION "PUBLIC"."Non_keywords" = ''
go
SET OPTION "PUBLIC"."SQL_flagger_error_level" = 'W'
go
SET OPTION "PUBLIC"."SQL_flagger_warning_level" = 'W'
go
SET OPTION "PUBLIC"."Ansi_blanks" = 'OFF'
go
SET OPTION "PUBLIC"."Ansi_integer_overflow" = 'OFF'
go
SET OPTION "PUBLIC"."String_rtruncation" = 'OFF'
go
SET OPTION "PUBLIC"."Divide_by_zero_error" = 'ON'
go
SET OPTION "PUBLIC"."Ansinull" = 'ON'
go
SET OPTION "PUBLIC"."Ansi_permissions" = 'ON'
go
SET OPTION "PUBLIC"."Close_on_endtrans" = 'ON'
go
SET OPTION "PUBLIC"."Tsql_variables" = 'OFF'
go
SET OPTION "PUBLIC"."RI_Trigger_time" = 'AFTER'
go
SET OPTION "PUBLIC"."Tsql_hex_constant" = 'ON'
go
SET OPTION "PUBLIC"."Chained" = 'ON'
go
SET OPTION "PUBLIC"."Nearest_century" = '0'
go
SET OPTION "PUBLIC"."Fire_triggers" = 'ON'
go
SET OPTION "PUBLIC"."Background_priority" = 'OFF'
go
SET OPTION "PUBLIC"."Login_mode" = 'Standard'
go
SET OPTION "PUBLIC"."Float_as_double" = 'OFF'
go
SET OPTION "PUBLIC"."Default_timestamp_increment" = '1'
go
SET OPTION "PUBLIC"."Escape_character" = 'ON'
go
SET OPTION "PUBLIC"."Continue_after_raiserror" = 'OFF'
go
SET OPTION "PUBLIC"."Auto_commit" = 'OFF'
go
SET OPTION "PUBLIC"."Auto_refetch" = 'ON'
go
SET OPTION "PUBLIC"."Bell" = 'ON'
go
SET OPTION "PUBLIC"."Command_delimiter" = ';'
go
SET OPTION "PUBLIC"."Commit_on_exit" = 'ON'
go
SET OPTION "PUBLIC"."Echo" = 'ON'
go
SET OPTION "PUBLIC"."Headings" = 'On'
go
SET OPTION "PUBLIC"."Input_format" = 'ASCII'
go
SET OPTION "PUBLIC"."ISQL_log" = ''
go
SET OPTION "PUBLIC"."NULLS" = '(NULL)'
go
SET OPTION "PUBLIC"."On_error" = 'PROMPT'
go
SET OPTION "PUBLIC"."Output_format" = 'ASCII'
go
SET OPTION "PUBLIC"."Output_length" = '0'
go
SET OPTION "PUBLIC"."Output_nulls" = ''
go
SET OPTION "PUBLIC"."Quiet" = 'OFF'
go
SET OPTION "PUBLIC"."Screen_format" = 'TEXT'
go
SET OPTION "PUBLIC"."SQLConnect" = ''
go
SET OPTION "PUBLIC"."SQLStart" = ''
go
SET OPTION "PUBLIC"."Statistics" = '3'
go
SET OPTION "PUBLIC"."Truncation_length" = '30'
go
SET OPTION "PUBLIC"."Verify_all_columns" = 'Off'
go
SET OPTION "PUBLIC"."Delete_old_logs" = 'Off'
go
SET OPTION "PUBLIC"."Qualify_owners" = 'On'
go
SET OPTION "PUBLIC"."Quote_all_identifiers" = 'Off'
go
SET OPTION "PUBLIC"."Replication_error" = ''
go
SET OPTION "PUBLIC"."Subscribe_by_remote" = 'On'
go
SET OPTION "PUBLIC"."Verify_threshold" = '1000'
Go
Commit work
Go
Gracias Experto.
te hago la ultima consulta.
yo tengo esto para crear la tabla en el scrip de power pero me tira un error en lo que te pongo como ***, yo lo probe en ISQL y crea la tabla perfectamente con este scrip pero en power me da el error Nº 03 de sintaxis.
es posible que falte algo en el scrip de power para que lo tome ???
muchas gracias y que tengas un excelente año. saludos
***
CREATE TABLE "dba"."facturas" ("id" integer NOT NULL DEFAULT autoincrement,"nombre" varchar(10),primary key ("id"));
***
insert into "dba"."pbcattbl"
(pbt_tnam,
pbt_ownr,
pbd_fhgt,
pbd_fwgt,
pbd_fitl,
pbd_funl,
pbd_fchr,
pbd_fptc,
pbd_ffce,
pbh_fhgt,
pbh_fwgt,
pbh_fitl,
pbh_funl,
pbh_fchr,
pbh_fptc,
pbh_ffce,
pbl_fhgt,
pbl_fwgt,
pbl_fitl,
pbl_funl,
pbl_fchr,
pbl_fptc,
pbl_ffce,
pbt_cmnt)
values
('nombre',
'dba',
-10,
400,
'N',
'N',
0,
34,
'Arial',
-10,
400,
'N',
'N',
0,
34,
'Arial',
-10,
400 ,
'N',
'N',
0,
34,
'Arial',
'');
insert into "dba"."pbcatcol"
(pbc_tnam,
pbc_ownr,
pbc_cnam,
pbc_labl,
pbc_lpos,
pbc_hdr,
pbc_hpos,
pbc_jtfy,
pbc_mask,
pbc_case,
pbc_hght,
pbc_wdth,
pbc_bmap)
values
('nombre',
'dba',
'id',
'Id:',
0 ,
'Id',
0,
24 ,
'[General]',
0 ,
65 ,
165 ,
'N');
insert into "dba"."pbcatcol"
(pbc_tnam,
pbc_ownr,
pbc_cnam,
pbc_labl,
pbc_lpos,
pbc_hdr,
pbc_hpos,
pbc_jtfy,
pbc_case,
pbc_hght,
pbc_wdth,
pbc_bmap)
values
('nombre',
'dba',
'nombre',
'Nombre:',
0 ,
'Nombre',
0,
23 ,
0 ,
65 ,
238 ,
'N');
te hago la ultima consulta.
yo tengo esto para crear la tabla en el scrip de power pero me tira un error en lo que te pongo como ***, yo lo probe en ISQL y crea la tabla perfectamente con este scrip pero en power me da el error Nº 03 de sintaxis.
es posible que falte algo en el scrip de power para que lo tome ???
muchas gracias y que tengas un excelente año. saludos
***
CREATE TABLE "dba"."facturas" ("id" integer NOT NULL DEFAULT autoincrement,"nombre" varchar(10),primary key ("id"));
***
insert into "dba"."pbcattbl"
(pbt_tnam,
pbt_ownr,
pbd_fhgt,
pbd_fwgt,
pbd_fitl,
pbd_funl,
pbd_fchr,
pbd_fptc,
pbd_ffce,
pbh_fhgt,
pbh_fwgt,
pbh_fitl,
pbh_funl,
pbh_fchr,
pbh_fptc,
pbh_ffce,
pbl_fhgt,
pbl_fwgt,
pbl_fitl,
pbl_funl,
pbl_fchr,
pbl_fptc,
pbl_ffce,
pbt_cmnt)
values
('nombre',
'dba',
-10,
400,
'N',
'N',
0,
34,
'Arial',
-10,
400,
'N',
'N',
0,
34,
'Arial',
-10,
400 ,
'N',
'N',
0,
34,
'Arial',
'');
insert into "dba"."pbcatcol"
(pbc_tnam,
pbc_ownr,
pbc_cnam,
pbc_labl,
pbc_lpos,
pbc_hdr,
pbc_hpos,
pbc_jtfy,
pbc_mask,
pbc_case,
pbc_hght,
pbc_wdth,
pbc_bmap)
values
('nombre',
'dba',
'id',
'Id:',
0 ,
'Id',
0,
24 ,
'[General]',
0 ,
65 ,
165 ,
'N');
insert into "dba"."pbcatcol"
(pbc_tnam,
pbc_ownr,
pbc_cnam,
pbc_labl,
pbc_lpos,
pbc_hdr,
pbc_hpos,
pbc_jtfy,
pbc_case,
pbc_hght,
pbc_wdth,
pbc_bmap)
values
('nombre',
'dba',
'nombre',
'Nombre:',
0 ,
'Nombre',
0,
23 ,
0 ,
65 ,
238 ,
'N');
Proba cambiar el usuario de la tabla, sacale la parte que dice "dba"., es decir correrlo de esta forma:
CREATE TABLE "facturas" ("id" integer NOT NULL DEFAULT autoincrement,
"nombre" varchar(10),primary key ("id"));
Sinó te funciona, pasame el error para darme una idea del problema.
CREATE TABLE "facturas" ("id" integer NOT NULL DEFAULT autoincrement,
"nombre" varchar(10),primary key ("id"));
Sinó te funciona, pasame el error para darme una idea del problema.
Te paso el error que me da.
(0003):error C0031:syntax error.
la verdad es que no si falta algo como para que tome el sql(DLL).
estuve mirando la ayuda y hay un execute inmediate. algo asi que no se bien para que es pero lo vi varias veces.
Ya me da cosa molestarte y ocupar tu tiempo pero te agradezco mucho tu ayuda
(0003):error C0031:syntax error.
la verdad es que no si falta algo como para que tome el sql(DLL).
estuve mirando la ayuda y hay un execute inmediate. algo asi que no se bien para que es pero lo vi varias veces.
Ya me da cosa molestarte y ocupar tu tiempo pero te agradezco mucho tu ayuda
Debes tener un problema en la instalación del PB o del Sybase anyware.
Yo corrí el query, tal cual te lo pase y me crea la tabla sin problemas.
Mi configuración es PB 6.5, y la conexión al SQL anyware es a travez del ODBC.
Si el mismo query funciona bien en el isql contra el sybse anyware, seguramente el problema lo tenés en el PB.
Espera te haya sido de ayuda.
Yo corrí el query, tal cual te lo pase y me crea la tabla sin problemas.
Mi configuración es PB 6.5, y la conexión al SQL anyware es a travez del ODBC.
Si el mismo query funciona bien en el isql contra el sybse anyware, seguramente el problema lo tenés en el PB.
Espera te haya sido de ayuda.
- Compartir respuesta
- Anónimo
ahora mismo