| Author |
Topic |
|
mattew
Starting Member
9 Posts |
Posted - 2003-01-15 : 08:27:33
|
| I have to do a query that read description of the field.I have found this query that works 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? |
|
|
Robwhittaker
Yak Posting Veteran
85 Posts |
Posted - 2003-01-15 : 08:41:34
|
| What exactly are you after? Have you tries some of the special stored procedures?Check out sp_helpSee BOL for more detailsRob |
 |
|
|
mattew
Starting Member
9 Posts |
Posted - 2003-01-15 : 08:52:14
|
| after I have records that contain for example: field "name": name of the tablefield "Expr1": name of the fieldfield "lenght": ..............field "ColdDescription": <Binary>In this last field I expected the description of the column. But it doesn't work.What king of special store procedure ?What is BOL ?thank you |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-01-15 : 08:56:19
|
quote: What is BOL ?
It's what you get when you press shift + f1 in query analyzer.-------Moo. |
 |
|
|
mattew
Starting Member
9 Posts |
Posted - 2003-01-15 : 09:02:52
|
| ops....BOL = book on lineI've already read, but I always had my problem |
 |
|
|
Robwhittaker
Yak Posting Veteran
85 Posts |
Posted - 2003-01-15 : 09:07:40
|
| Check out SP_HELP in BOL, I think it probably does what you want, and suggests over stored procedures that come with SQLServer, They are very usful.The basic syntax is sp_help object (table) name and it "describes" the object (table) |
 |
|
|
mattew
Starting Member
9 Posts |
Posted - 2003-01-15 : 09:42:07
|
| it' s very useful but there are not information about description! |
 |
|
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2003-01-15 : 11:21:26
|
| Does SQL support field (column) descriptions? (like the ones Access has). Mine doesn't.Sarah Berger MCSD |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-01-15 : 11:26:02
|
| IN SQL2KGo to diagram modify custom view and add description fieldor to table design and description is underneath like in access.Edited by - ValterBorges on 01/15/2003 11:27:07 |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2003-01-15 : 11:55:09
|
As far as I can see, this should work in SQL Server 2000.sysproperties."Value" is a sql_variant, so it's possible that it's holding a binary value for the columns in question, but a straight text value entered into the Description field in Enterprise Manager gets stored as a variant with BaseType of nvarchar rather than varbinary. That's according to SQL_VARIANT_PROPERTY(colprop.[value], 'Basetype')This any use? I haven't read it in detail:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro02/html/sql02a10.aspEdit: Thank you very much for cross-posting this query and wasting 20 minutes of my time.Edited by - Arnold Fribble on 01/15/2003 12:09:09 |
 |
|
|
|