Lists: | pgsql-fr-generale |
---|
From: | "Norbert Saint Georges" <Norbert(dot)Saint-Georges(at)generation-eco(dot)com> |
---|---|
To: | <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | utilitaire de conversion de scrip sql |
Date: | 2012-12-14 15:27:51 |
Message-ID: | 8534997D52846E4CA436A90A7140ABB055BE@database.ge.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Bonjour,
Connaissez-vous un/des utilitaires de conversion de script sql
msqql2k5 vers posgresql 9.2?
Cordialement.
Norbert Saint Georges
Six Sigma Business Intelligence Analyst
Generation ECO sprl
From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | Norbert Saint Georges <Norbert(dot)Saint-Georges(at)generation-eco(dot)com> |
Cc: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Re: utilitaire de conversion de scrip sql |
Date: | 2012-12-14 16:55:41 |
Message-ID: | 1355504141.16196.19.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Bonjour,
On Fri, 2012-12-14 at 17:27 +0200, Norbert Saint Georges wrote:
> [...]
> Connaissez-vous un/des utilitaires de conversion de script sql
> msqql2k5 vers posgresql 9.2?
>
Je suppose que vous parlez de SQL Server. Je ne connais pas d'outil
automatisé pour faire la migration. Quand j'ai eu besoin de faire ce
type de migration, j'avais codé mon propre outil pour ça mais je n'en ai
pas du tout les sources (je travaillais dans une autre entreprise à
l'époque). Actuellement, je pense que j'essaierais d'utiliser un ETL
comme Kettle.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
From: | Cédric Villemain <cedric(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Cc: | Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Norbert Saint Georges <Norbert(dot)Saint-Georges(at)generation-eco(dot)com> |
Subject: | Re: utilitaire de conversion de scrip sql |
Date: | 2012-12-14 17:16:22 |
Message-ID: | 201212141816.26145.cedric@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Le vendredi 14 décembre 2012 17:55:41, Guillaume Lelarge a écrit :
> Bonjour,
>
> On Fri, 2012-12-14 at 17:27 +0200, Norbert Saint Georges wrote:
> > [...]
> > Connaissez-vous un/des utilitaires de conversion de script sql
> > msqql2k5 vers posgresql 9.2?
>
> Je suppose que vous parlez de SQL Server. Je ne connais pas d'outil
> automatisé pour faire la migration. Quand j'ai eu besoin de faire ce
> type de migration, j'avais codé mon propre outil pour ça mais je n'en ai
> pas du tout les sources (je travaillais dans une autre entreprise à
> l'époque). Actuellement, je pense que j'essaierais d'utiliser un ETL
> comme Kettle.
En fonction du volume et de la complexité de ce qui doit être migré, cela peut
justifier des moteurs de ré-écriture automatisés, au minimum pour analyser le
code et déceler les cas trop ambigus.
Nous préparons un projet pour permettre de minimiser les modifications
applicatives et assurer la compatibilité du code SQL (la ré-écriture est faite
à la volée). Le même projet facilite aussi la ré-écriture de l'application qui
est de toute façon souhaitable à terme si l'on souhaite optimiser les
performances.
Comme Guillaume, je ne crois pas qu'il existe déjà une solution utilisable
dans votre cas.
--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation
From: | "Norbert Saint Georges" <Norbert(dot)Saint-Georges(at)generation-eco(dot)com> |
---|---|
To: | <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | Re: utilitaire de conversion de scrip sql |
Date: | 2012-12-15 12:07:41 |
Message-ID: | 8534997D52846E4CA436A90A7140ABB055C0@database.ge.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-fr-generale |
Merci pour vos réponses.
Effectivement je parlais de mssql :-)
Je vais le coder moi-même, je par du principe que toute les valeurs dont j'ai besoin se trouve dans les tables sys.
Du genre ( pour une DB 2005) :
select objects.name as ObjectName
, objects.type as ObjectType
, columns.name as ColumnName
, columns.column_id as colid
, columns.system_type_id as xtype
, columns.system_type_id as type
, (case when columns.max_length = -1 then 1073741823
when columns.system_type_id = 231 then columns.max_length/2
when columns.system_type_id = 99 then 1073741823
else columns.max_length
end
) as length
, columns.max_length
, columns.precision as prec
, cast(0 as bit) as cdefault
, cast(0 as bit) as isoutparam
, (case when columns.system_type_id = 36 then N'uniqueidentifier'
when columns.system_type_id = 48 then N'tinyint'
when columns.system_type_id = 56 then N'int'
when columns.system_type_id = 52 then N'smallint'
when columns.system_type_id = 127 then N'bigint'
when columns.system_type_id = 59 then N'real'
when columns.system_type_id = 62 then N'float(' + cast(columns.precision as varchar) + N')'
when columns.system_type_id = 60 then N'money'
when columns.system_type_id = 104 then N'bit'
when columns.system_type_id = 175 then N'char(' + cast(columns.max_length as varchar) + N')'
when columns.system_type_id = 167 then N'varchar(' + (case max_length when -1 then '8000' else cast(columns.max_length as varchar) end) + N')'
when columns.system_type_id = 231 then N'varchar(' + (case max_length when -1 then '8000' else cast(columns.max_length/2 as varchar) end) + N')'
when columns.system_type_id = 239 then N'char(' + cast(columns.max_length/2 as varchar) + N')'
when columns.system_type_id = 35 then N'text'
when columns.system_type_id = 99 then N'text'
when columns.system_type_id = 61 then N'datetime'
when columns.system_type_id = 34 then N'image'
when columns.system_type_id = 106 then N'decimal(' + cast(columns.precision as varchar) + N', ' + cast(columns.scale as varchar) + N')'
when columns.system_type_id = 108 then N'decimal(' + cast(columns.precision as varchar) + N', ' + cast(columns.scale as varchar) + N')'
when columns.system_type_id = 165 then N'varbinary('+ (case max_length when -1 then 'max' else cast(columns.max_length as varchar) end) + N')'
when columns.system_type_id = 173 then N'binary(' + cast(columns.max_length as varchar) + N')'
when columns.system_type_id = 189 then N'timestamp'
end
) as ColumnType
, (case when columns.system_type_id = 36 then N'SqlDbType.UniqueIdentifier'
when columns.system_type_id = 48 then N'SqlDbType.TinyInt'
when columns.system_type_id = 56 then N'SqlDbType.Int'
when columns.system_type_id = 52 then N'SqlDbType.SmallInt'
when columns.system_type_id = 127 then N'SqlDbType.BigInt'
when columns.system_type_id = 59 then N'SqlDbType.Real'
when columns.system_type_id = 62 then N'SqlDbType.Real'
when columns.system_type_id = 60 then N'SqlDbType.Money'
when columns.system_type_id = 104 then N'SqlDbType.Bit'
when columns.system_type_id = 175 then N'SqlDbType.Char'
when columns.system_type_id = 167 then N'SqlDbType.VarChar'
when columns.system_type_id = 231 then N'SqlDbType.NVarChar'
when columns.system_type_id = 239 then N'SqlDbType.NChar'
when columns.system_type_id = 35 then N'SqlDbType.Text'
when columns.system_type_id = 99 then N'SqlDbType.NText'
when columns.system_type_id = 61 then N'SqlDbType.DateTime'
when columns.system_type_id = 34 then N'SqlDbType.VarBinary'
when columns.system_type_id = 106 then N'SqlDbType.Real'
when columns.system_type_id = 108 then N'SqlDbType.Real'
when columns.system_type_id = 165 then N'SqlDbType.VarBinary'
when columns.system_type_id = 173 then N'SqlDbType.Binary'
when columns.system_type_id = 189 then N'SqlDbType.TimeStamp'
end
) as SqlDbType
, (case when columns.system_type_id = 36 then N'Guid'
when columns.system_type_id = 48 then N'short'
when columns.system_type_id = 56 then N'Int32'
when columns.system_type_id = 52 then N'Int16'
when columns.system_type_id = 127 then N'Int64'
when columns.system_type_id = 59 then N'float'
when columns.system_type_id = 62 then N'float'
when columns.system_type_id = 60 then N'decimal'
when columns.system_type_id = 104 then N'bool'
when columns.system_type_id = 175 then N'ansistring'
when columns.system_type_id = 167 then N'ansistring'
when columns.system_type_id = 231 then N'string'
when columns.system_type_id = 239 then N'string'
when columns.system_type_id = 35 then N'string'
when columns.system_type_id = 99 then N'string'
when columns.system_type_id = 61 then N'DateTime'
when columns.system_type_id = 34 then N'byte[]'
when columns.system_type_id = 106 then N'float'
when columns.system_type_id = 108 then N'float'
when columns.system_type_id = 165 then N'byte[]'
when columns.system_type_id = 173 then N'byte[]'
when columns.system_type_id = 189 then N'TimeStamp'
end
) as CsType
, (case when columns.system_type_id = 36 then N'g'
when columns.system_type_id = 48 then N'n'
when columns.system_type_id = 56 then N'n'
when columns.system_type_id = 52 then N'n'
when columns.system_type_id = 127 then N'l'
when columns.system_type_id = 59 then N'fl'
when columns.system_type_id = 62 then N'fl'
when columns.system_type_id = 60 then N'd'
when columns.system_type_id = 104 then N'b'
when columns.system_type_id = 175 then N's'
when columns.system_type_id = 167 then N's'
when columns.system_type_id = 231 then N's'
when columns.system_type_id = 239 then N's'
when columns.system_type_id = 35 then N's'
when columns.system_type_id = 99 then N's'
when columns.system_type_id = 61 then N'dt'
when columns.system_type_id = 34 then N'by'
when columns.system_type_id = 106 then N'fl'
when columns.system_type_id = 108 then N'fl'
when columns.system_type_id = 165 then N'bin'
when columns.system_type_id = 173 then N'bin'
when columns.system_type_id = 189 then N'ts'
end
) as CsPrefix
, columns.is_identity as IsIdentity
, columns.is_nullable as IsNullable
from sys.objects objects
inner join sys.columns columns
on columns.object_id = objects.object_id
where objects.name <> 'dtproperties'
and objects.type in ('U', 'V')
and objects.name = :TableName
Cela vous semblent logique comme point de départ ?
Maintenant, je cherche un tableau « valide » des correspondances pour Npgsql.
Cordialement
Norbert Saint Georges
Six Sigma Business Intelligence Analyst
Generation ECO sprl