SQL Server - De SQL 2000 a 2005

 
Vista:

De SQL 2000 a 2005

Publicado por Fher Arevalo (1 intervención) el 13/10/2008 22:53:47
Hola a todos!!!

tengo un pequeño problemitca con sql server 2000 y 2005, tengo la siguiente vista en sql server 2000 pero quiero pasarla a 2005 y hay unos campos de los cuales no me se el equivalente en 2005, espero alguien me pueda hechar la mano para esta vista...

saludos......

CREATE view [dbo].[desc_tablas_campos] as
select
sys.objects.name tabla,
sys.columns.colid orden,
sys.columns.name columna,
case when sys.sysindexkeys.colid is null then ' ' else 'PK' end es_primarykey,
type_name(xusertype) + ' ' +
case
when sys.columns.xtype = 231
then '(' + convert(varchar,sys.columns.prec) + ')'
when charindex(type_name(sys.columns.xtype), N'decimal,money,numeric,smallmoney') > 0
then '(' + convert(nvarchar,ColumnProperty(sys.columns.column _id, sys.columns.name, 'precision')) + ', ' +
convert(nvarchar,ColumnProperty(sys.columns.column _id, sys.columns.name, 'scale')) + ')'
else '' end tipo,
case when isnullable = 0 then 'NO' else '' end nulo,
convert(nvarchar(2000), sys.extended_properties.value) descripcion,
type_name(xusertype) xtipo,
case when sys.columns.xtype = 231
then convert(smallint, isnull(sys.columns.prec, 0))
else convert(smallint, isnull(sys.columns.length, 0)) end length,
convert(smallint, isnull(sys.columns.prec, 0)) prec,
convert(smallint, isnull(sys.columns.scale, 0)) scale
from sys.columns
join sys.objects on sys.columns.column_id = sys.objects.object_id
left join sys.indexes on sys.indexes.index_id = sys.objects.object_id and (sys.indexes.status & 2048) <> 0
left join sys.sysindexkeys on sys.columns.column_id = sys.sysindexkeys.id and sys.columns.colid = sys.sysindexkeys.colid and sys.indexes.indid = sys.sysindexkeys.indid
left join sys.extended_properties on sys.columns.column_id = sys.extended_properties.major_id and sys.extended_properties.minor_id = sys.columns.colorder and sys.extended_properties.name = 'MS_Description' and sys.extended_properties.type = 4
where sys.objects.xtype = 'U'
and sys.objects.name <> 'dtproperties'
and not sys.objects.name like 'doc%'
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder