Vous n'êtes pas identifié(e).
- Contributions : Récentes | Sans réponse
Pages : 1
#1 Migration » Migration script SQLServer vers PostGreSQL » 26/12/2012 15:38:09
- toulouseadr
- Réponses : 2
Bonjour à tous je le script SQLServer suivant et je cherche à le passer sous PostGresSQL, quelqu'un pourrait-il m'aider svp ?
Merci
DECLARE @state char(100);
SET @state = (SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Interaction' AND COLUMN_NAME = 'IntPlace');
IF 'char' = @state
BEGIN
PRINT 'IntPlace is a char DATA_TYPE'
IF 350 > (SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Interaction' AND COLUMN_NAME = 'IntPlace')
BEGIN
PRINT 'IntPlace is smaller than 350';
ALTER TABLE Interaction ALTER COLUMN IntPlace char(350);
END
END
IF 'varchar' = @state
BEGIN
PRINT 'IntPlace is a varchar DATA_TYPE'
IF 350 > (SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Interaction' AND COLUMN_NAME = 'IntPlace')
BEGIN
PRINT 'IntPlace is smaller than 350';
ALTER TABLE Interaction ALTER COLUMN IntPlace varchar(350);
END
END
IF 'nvarchar' = @state
BEGIN
PRINT 'IntPlace is a nvarchar DATA_TYPE'
IF 350 > (SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Interaction' AND COLUMN_NAME = 'IntPlace')
BEGIN
PRINT 'IntPlace is smaller than 350';
ALTER TABLE Interaction ALTER COLUMN IntPlace nvarchar(350);
END
END
IF 'nchar' = @state
BEGIN
PRINT 'IntPlace is a nchar DATA_TYPE'
IF 350 > (SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Interaction' AND COLUMN_NAME = 'IntPlace')
BEGIN
PRINT 'IntPlace is smaller than 350';
ALTER TABLE Interaction ALTER COLUMN IntPlace nchar(350);
END
END
Pages : 1