Skip site navigation (1) Skip section navigation (2)

RE: scripts de sql convertir a postgresql

From: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
To: <lnto_27(at)yahoo(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: scripts de sql convertir a postgresql
Date: 2008-08-28 21:02:11
Message-ID: BLU137-W3675A136B36E049F9EEE82E3600@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-es-ayuda
Si hay una herramienta se llama CEREBRO y debe de ser el tuyo para recrear eso.
Oye, una cosa es pedir ayuda y otra diferente que te hagamos la tarea.
En fin, que se supone que hace esto que fue por donde debiste empezar?


*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-849-8087

* " Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo comun"
*-------------------------------------------------------*


________________________________
Date: Tue, 26 Aug 2008 09:58:55 -0700
From: lnto_27(at)yahoo(dot)com
Subject: [pgsql-es-ayuda] scripts de sql convertir a postgresql
To: pgsql-es-ayuda(at)postgresql(dot)org

saludos

me pueden ayudar a convertir este scripts que esta hecho en sqlserver
necesito para un proyecto, o si me puedes informar de una herramientas que me permita convertir a un scripts de postgresql... no importa si no lo hace en su totalidad pero me puede servir cualquier informacion que me puedan brindar...

/************************************************************/
/*****              Initialization Script
*****/
/*****                                                  *****/
/*****                                                  *****/
/***** Note: To manually execute this script you must   *****/
/*****       perform a search and replace operation     *****/
/*****       for {databaseOwner} and {objectQualifier}
*****/
/*****                                                  *****/
/************************************************************/

if exists (select * from dbo.sysobjects where id = object_id(N'Version') and OBJECTPROPERTY(id, N'IsTable') = 1)
begin
  if '{objectQualifier}' <> ''
  begin
    EXECUTE sp_rename N'{databaseOwner}Version', N'{objectQualifier}Version', 'OBJECT'
    EXECUTE sp_rename N'PK_Version', N'PK_{objectQualifier}Version', 'OBJECT'
    EXECUTE sp_rename N'IX_Version', N'IX_{objectQualifier}Version', 'INDEX'

    ALTER TABLE {databaseOwner}{objectQualifier}Version ADD
CONSTRAINT
    IX_{objectQualifier}Version UNIQUE NONCLUSTERED
    (
    Major,
    Minor,
    Build
    ) ON [PRIMARY]
  end
end
else
begin
  if not exists (select * from dbo.sysobjects where id = object_id(N'{objectQualifier}Version') and OBJECTPROPERTY(id, N'IsTable') = 1)
  begin
    CREATE TABLE {databaseOwner}{objectQualifier}Version (
      [VersionId] [int] IDENTITY (1, 1) NOT NULL ,
        [Major] [int] NOT NULL ,
      [Minor] [int] NOT NULL ,
      [Build] [int] NOT NULL ,
      [CreatedDate] [datetime] NOT NULL
    ) ON [PRIMARY]

    ALTER TABLE {databaseOwner}{objectQualifier}Version WITH NOCHECK ADD

   CONSTRAINT [PK_{objectQualifier}Version] PRIMARY KEY  CLUSTERED
      (
        [VersionId]
      )  ON [PRIMARY]

    ALTER TABLE {databaseOwner}{objectQualifier}Version ADD CONSTRAINT
    IX_{objectQualifier}Version UNIQUE NONCLUSTERED
    (
    Major,
    Minor,
    Build
    ) ON [PRIMARY]

  end
end
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{objectQualifier}GetDatabaseVersion') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}{objectQualifier}GetDatabaseVersion
GO

create procedure {databaseOwner}{objectQualifier}GetDatabaseVersion

as

select Major,

Minor,
       Build
from   {objectQualifier}Version
where  VersionId = ( select max(VersionId) from {objectQualifier}Version )

GO

if exists (select * from dbo.sysobjects where id = object_id(N'{objectQualifier}FindDatabaseVersion') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}{objectQualifier}FindDatabaseVersion
GO

create procedure {databaseOwner}{objectQualifier}FindDatabaseVersion

@Major  int,
@Minor  int,
@Build  int

as

select 1
from   {objectQualifier}Version
where  Major = @Major
and    Minor = @Minor
and    Build = @Build

GO

if exists (select * from dbo.sysobjects where id = object_id(N'{objectQualifier}UpdateDatabaseVersion') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure
{databaseOwner}{objectQualifier}UpdateDatabaseVersion
GO

create procedure {databaseOwner}{objectQualifier}UpdateDatabaseVersion

@Major  int,
@Minor  int,
@Build  int

as

insert into {objectQualifier}Version (
  Major,
  Minor,
  Build,
  CreatedDate
)
values (
  @Major,
  @Minor,
  @Build,
  getdate()
)

GO

de antemano gracias por su respuesta.... me podrian enviar a mi email....

attt

luis









________________________________

Yahoo! MTV Blog & Rock
¡Cuéntanos tu historia, inspira una canción y gánate un viaje a los Premios MTV!
Participa aquí http://mtvla.yahoo.com/

_________________________________________________________________
Reveal your inner athlete and share it with friends on Windows Live.
http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us

In response to

Responses

pgsql-es-ayuda by date

Next:From: Edwin QuijadaDate: 2008-08-28 21:12:03
Subject: RE: Manual de instalación
Previous:From: Edwin QuijadaDate: 2008-08-28 20:52:54
Subject: RE: NOTIFY del log ??

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group