[Q] Mise a jour de la description d'un champ d'une table
1 réponse
Pouy
Bonjour,
j'ai dans une table (SRC) l'ensemble des champs d'une autre table (TAB)
avec leurs descriptions.
Peut on, par PS ou autre chose, parcourir les champs de TAB pour mettre
a jour les descriptions des champs ?
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
AXL
j'ai une ptite piste pour toi, soit tu utilise sp_columns ou cette requete
SELECT COLUMN_NAME = convert(sysname,c.name), convert (sysname,case when t.xusertype > 255 then t.name else d.TYPE_NAME collate database_default end) TYPE_NAME, convert(int,case when d.DATA_TYPE in (6,7) then d.data_precision else OdbcPrec(c.xtype,c.length,c.xprec) end) "PRECISION", convert(int,case when type_name(d.ss_dtype) IN ('numeric','decimal') then OdbcPrec(c.xtype,c.length,c.xprec)+2 else isnull(d.length, c.length) end) LENGTH, NULLABLE = convert(smallint, ColumnProperty (c.id, c.name, 'AllowsNull'))
FROM sysobjects o, master.dbo.spt_datatype_info d, systypes t, syscolumns c LEFT OUTER JOIN syscomments m on c.cdefault = m.id AND m.colid = 1 WHERE o.name like 'Ma_table'
AND o.id = c.id AND t.xtype = d.ss_dtype AND c.length = isnull(d.fixlen, c.length) AND (d.ODBCVer is null) AND (o.type not in ('P', 'FN', 'TF', 'IF') OR (o.type in ('TF', 'IF') and c.number = 0)) AND isnull(d.AUTO_INCREMENT,0) = isnull(ColumnProperty (c.id, c.name, 'IsIdentity'),0) AND c.xusertype = t.xusertype
order by c.colorder "Pouy" a écrit dans le message de news:
Bonjour, j'ai dans une table (SRC) l'ensemble des champs d'une autre table (TAB) avec leurs descriptions. Peut on, par PS ou autre chose, parcourir les champs de TAB pour mettre a jour les descriptions des champs ?
Merci d'avance. Pouy.
j'ai une ptite piste pour toi,
soit tu utilise sp_columns
ou cette requete
SELECT
COLUMN_NAME = convert(sysname,c.name),
convert (sysname,case
when t.xusertype > 255 then t.name
else d.TYPE_NAME collate database_default
end) TYPE_NAME,
convert(int,case
when d.DATA_TYPE in (6,7) then d.data_precision
else OdbcPrec(c.xtype,c.length,c.xprec)
end) "PRECISION",
convert(int,case
when type_name(d.ss_dtype) IN ('numeric','decimal') then
OdbcPrec(c.xtype,c.length,c.xprec)+2
else
isnull(d.length, c.length)
end) LENGTH,
NULLABLE = convert(smallint, ColumnProperty (c.id, c.name, 'AllowsNull'))
FROM
sysobjects o,
master.dbo.spt_datatype_info d,
systypes t,
syscolumns c
LEFT OUTER JOIN syscomments m on c.cdefault = m.id
AND m.colid = 1
WHERE
o.name like 'Ma_table'
AND o.id = c.id
AND t.xtype = d.ss_dtype
AND c.length = isnull(d.fixlen, c.length)
AND (d.ODBCVer is null)
AND (o.type not in ('P', 'FN', 'TF', 'IF') OR (o.type in ('TF', 'IF') and
c.number = 0))
AND isnull(d.AUTO_INCREMENT,0) = isnull(ColumnProperty (c.id, c.name,
'IsIdentity'),0)
AND c.xusertype = t.xusertype
order by c.colorder
"Pouy" <No.Mail@france.fr> a écrit dans le message de
news:mesnews.a3c07d47.b14c04ed.18.11876@france.fr...
Bonjour,
j'ai dans une table (SRC) l'ensemble des champs d'une autre table (TAB)
avec leurs descriptions.
Peut on, par PS ou autre chose, parcourir les champs de TAB pour mettre
a jour les descriptions des champs ?
j'ai une ptite piste pour toi, soit tu utilise sp_columns ou cette requete
SELECT COLUMN_NAME = convert(sysname,c.name), convert (sysname,case when t.xusertype > 255 then t.name else d.TYPE_NAME collate database_default end) TYPE_NAME, convert(int,case when d.DATA_TYPE in (6,7) then d.data_precision else OdbcPrec(c.xtype,c.length,c.xprec) end) "PRECISION", convert(int,case when type_name(d.ss_dtype) IN ('numeric','decimal') then OdbcPrec(c.xtype,c.length,c.xprec)+2 else isnull(d.length, c.length) end) LENGTH, NULLABLE = convert(smallint, ColumnProperty (c.id, c.name, 'AllowsNull'))
FROM sysobjects o, master.dbo.spt_datatype_info d, systypes t, syscolumns c LEFT OUTER JOIN syscomments m on c.cdefault = m.id AND m.colid = 1 WHERE o.name like 'Ma_table'
AND o.id = c.id AND t.xtype = d.ss_dtype AND c.length = isnull(d.fixlen, c.length) AND (d.ODBCVer is null) AND (o.type not in ('P', 'FN', 'TF', 'IF') OR (o.type in ('TF', 'IF') and c.number = 0)) AND isnull(d.AUTO_INCREMENT,0) = isnull(ColumnProperty (c.id, c.name, 'IsIdentity'),0) AND c.xusertype = t.xusertype
order by c.colorder "Pouy" a écrit dans le message de news:
Bonjour, j'ai dans une table (SRC) l'ensemble des champs d'une autre table (TAB) avec leurs descriptions. Peut on, par PS ou autre chose, parcourir les champs de TAB pour mettre a jour les descriptions des champs ?