Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 04-03-2004
teletranx teletranx is offline
Miembro
 
Registrado: feb 2004
Ubicación: Chile
Posts: 112
Poder: 23
teletranx Va por buen camino
Talking

Juan Antonio

Respondiendo a tus preguntas
te envio sp que clona tablas

CREATE PROCEDURE P_CLONATABLA (
TABLA VARCHAR(10),
NEDES INTEGER)
AS
DECLARE VARIABLE CAMPO VARCHAR(100);
DECLARE VARIABLE SOURCE VARCHAR(100);
DECLARE VARIABLE TOTALCAMPOS INTEGER;
DECLARE VARIABLE CONTADOR INTEGER;
DECLARE VARIABLE LARGO INTEGER;
DECLARE VARIABLE SCALE INTEGER;
DECLARE VARIABLE TIPO INTEGER;
DECLARE VARIABLE SUBTIPO INTEGER;
DECLARE VARIABLE NPRECISION INTEGER;
DECLARE VARIABLE CTIPO VARCHAR(20);
DECLARE VARIABLE SQL VARCHAR(32000);
DECLARE VARIABLE BORRAR VARCHAR(100);
DECLARE VARIABLE TABLAPASO VARCHAR(20);
DECLARE VARIABLE TABLASAL CHAR(20);
begin
TablaPaso = 'PASO' || TABLA;
TablaSal = 'C:\' || TABLA || '.TXT';
Select Count(*)
From rdb$relation_fields
where rdb$relation_name = :TablaPaso
into :TotalCampos;
if (TotalCampos = 0) then
Begin
Sql = 'CREATE TABLE ' || TablaPaso || ' (';

Contador = 1;
Select Count(*)
From rdb$relation_fields
where rdb$relation_name = :TABLA
into :TotalCampos;
For
Select R.RDB$Field_Name, r.rdb$Field_Source, f.rdb$Field_Length,
f.rdb$Field_Scale, f.rdb$Field_Type, f.rdb$Field_Sub_Type,
f.rdb$Field_Precision From rdb$relation_fields R, rdb$Fields f
where R.rdb$relation_name = :Tabla and r.rdb$Field_Source = f.rdb$Field_Name
ORDER BY R.rdb$field_position
Into :Campo, :Source, :Largo, :Scale, :Tipo, :SubTipo,
:nPrecision
Do
Begin
if (substr(f_lrtrim(Source),1,4) <> 'RDB$') then
Begin
if (Contador < TotalCampos) then
begin
Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(Source) || ',';
end
else
begin
Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(Source);
end
End
else
Begin
Scale = Abs(Scale);
if (Tipo = 7) Then cTipo = 'SMALLINT';
if (Tipo = 8) THEN cTipo = 'INTEGER';
if (Tipo = 10) Then cTipo = 'FLOAT';
if (Tipo = 27) Then cTipo = 'DOUBLE PRECISION';
if (Tipo = 12) THEN cTipo = 'DATE';
if (Tipo = 13) Then cTipo = 'TIME';
if (Tipo = 35) Then cTipo = 'TIMESTAMP';
if (Tipo = 14) THEN cTipo = 'CHAR(' || f_lrtrim(Cast (Largo as VarChar(5))) || ')';
if (Tipo = 37) THEN cTipo = 'VARCHAR(' || f_lrtrim(Cast (Largo as VarChar(5))) || ')';
if (((Tipo = 8) or (Tipo = 16)) and
(SubTipo = 1)) Then cTipo = 'NUMERIC('|| f_lrtrim(Cast (nPrecision as VarChar(5))) ||
',' || f_lrtrim(Cast (Scale as VarChar(5))) || ')';
if (((Tipo = 8) or (Tipo = 16)) and
(SubTipo = 2)) Then cTipo = 'DECIMAL('|| f_lrtrim(Cast (nPrecision as VarChar(5))) ||
',' || f_lrtrim(Cast (Scale as VarChar(5))) || ')';
if ((Tipo = 261) and (SubTipo = 0)) Then cTipo = 'BLOB SUB_TYPE 0 SEGMENT SIZE 80';
if ((Tipo = 261) and (SubTipo = 1)) Then cTipo = 'BLOB SUB_TYPE 1 SEGMENT SIZE 80';
if (Contador < TotalCampos) then
begin
Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(cTipo) || ',';
end
else
begin
Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(cTipo);
end
End
Contador = Contador + 1;
End
Sql = Sql || ')';
execute statement Sql;
--Update RDB$RELATIONS Set RDB$EXTERNAL_FILE = :TablaSal Where
-- RDB$RELATION_NAME = :TablaPaso;
End
Else
Begin
Borrar = 'Delete from ' || TablaPaso || ' Where Ne =' || Cast(NeDes as VarChar(5));
execute statement Borrar;
End
end

Este sp clona tabla si existe, con FireBird 1.5

Lo otro estoy de administrador del equipo

Juan Carlos

Última edición por teletranx fecha: 24-03-2004 a las 17:24:51.
Responder Con Cita
  #2  
Antiguo 04-03-2004
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Poder: 26
guillotmarc Va por buen camino
Comprueba la variable ExternalFileAccess del fichero de configuración de Firebird, si está a None cámbialo a Full

En las Release Notes encontrarás más información (en este link las encontrarás en castellano) http://www.ibphoenix.com/downloads/F...tesSpanish.pdf

Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita
  #3  
Antiguo 04-03-2004
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Poder: 26
guillotmarc Va por buen camino
Por cierto, el fichero de configuración es el firebird.conf.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita
  #4  
Antiguo 05-03-2004
teletranx teletranx is offline
Miembro
 
Registrado: feb 2004
Ubicación: Chile
Posts: 112
Poder: 23
teletranx Va por buen camino
lei el pdf con la configuración de los Archivos Externos (External Files), probe Full, nada, también probe Restrict C:\ExternalTables, nada

aún tengo el mismo problema
Responder Con Cita
  #5  
Antiguo 05-03-2004
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Poder: 26
guillotmarc Va por buen camino
¿ Has quitado el símbolo # (comentario) al principio de la línea ?. Creo que debes reiniciar el Servidor Firebird una vez configurado el cambio.

Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita
  #6  
Antiguo 05-03-2004
teletranx teletranx is offline
Miembro
 
Registrado: feb 2004
Ubicación: Chile
Posts: 112
Poder: 23
teletranx Va por buen camino
Si lo hice, lo de eliminar #, y también de reiniciar la máquina pero igual me sale el mismo mensaje de que el se ha negado el acceso por el administrador del servidor


Saludos.

Juan Carlos
Responder Con Cita
  #7  
Antiguo 05-03-2004
Avatar de jachguate
jachguate jachguate is offline
Miembro
 
Registrado: may 2003
Ubicación: Guatemala
Posts: 6.254
Poder: 30
jachguate Va por buen camino
Cita:
Empezado por teletranx
estoy de administrador del equipo
Pues el usuario que realmente importa es bajo el que corre el servicio de firebird.

Hasta luego.

__________________
Juan Antonio Castillo Hernández (jachguate)
Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 14:56:02.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi