January 15, 2003 at 4:24 am
I have to import a database with about 1000 description of the fields. I need a query or a function that do it.
I have found this query that work with sys table:
SELECT PERCENT so.name, sc.name AS Expr1, sc.xtype, sc.length, sc.colid, tableprop.[value] AS TableDescription, colprop.[value] AS ColDescription,
colprop.name AS Expr2
FROM dbo.sysobjects so LEFT OUTER JOIN
dbo.syscolumns sc ON sc.id = so.id LEFT OUTER JOIN
dbo.sysproperties tableprop ON tableprop.id = so.id AND tableprop.type = 3 LEFT OUTER JOIN
dbo.sysproperties colprop ON colprop.id = sc.id AND colprop.type = 4 AND colprop.smallid = sc.colid
WHERE (so.type = 'u') AND (so.name = 'TableName')
ORDER BY sc.colid
It's very good because the query should return in the "ColDescription" field the description of the field but it doesn't work correctly because ColDescription field display "<binary>"
can you help me?
January 15, 2003 at 11:29 am
Instead of: tableprop.[value]
try: cast(tableprop.value as varchar(8000))
Are you running this query from Enterprise Manager? If you run it in SQL Analyzer, the cols that return as binary will give you the value instead.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply