RE: scripts de sql convertir a postgresql

From: "Miguel Bernilla" <mbernilla(at)sedapal(dot)com(dot)pe>
To: <lnto_27(at)yahoo(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: scripts de sql convertir a postgresql
Date: 2008-09-02 20:43:23
Message-ID: 002001c90d3c$91003ac0$b300b040$@com.pe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Para cuando mas o menos lo quieres….???

De: pgsql-es-ayuda-owner(at)postgresql(dot)org [mailto:pgsql-es-ayuda-owner(at)postgresql(dot)org] En nombre de Luis Nieto
Enviado el: Martes, 26 de Agosto de 2008 11:59
Para: pgsql-es-ayuda(at)postgresql(dot)org
Asunto: [pgsql-es-ayuda] scripts de sql convertir a postgresql

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/

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Miguel Panuera 2008-09-02 20:48:39 PostgreSQL Spanish Documentation Project
Previous Message Agustin Casiva 2008-09-02 18:26:41 Re: Error en acceso a postgres desde php