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

scripts de sql convertir a postgresql

From: Luis Nieto <lnto_27(at)yahoo(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: scripts de sql convertir a postgresql
Date: 2008-08-26 16:58:55
Message-ID: 12304.88416.qm@web90304.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-es-ayuda
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 &gt;¡Cuéntanos tu historia, inspira una canción y gánate un viaje a los Premios MTV! Participa aquí http://mtvla.yahoo.com/

Responses

pgsql-es-ayuda by date

Next:From: Jenaro Centeno GómezDate: 2008-08-26 17:26:22
Subject: Re: scripts de sql convertir a postgresql
Previous:From: Gilberto Castillo MartínezDate: 2008-08-26 16:20:10
Subject: Re: consulta a varias tablas en una sola funcionen plpgsql

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