Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL_DMO to access extended properties

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-16 : 07:23:57
Sherry writes "Can you use SQL-DMO to edit the column description and table description? I am using SQL DMO to create a series of MSSQL tables from an excel spreadsheet. It is working great. Foreign keys and everything. I want to know if there is a method that will allow me to also supply the column descriptions. Thanks.
Here is a snipit of code from the excel macro....

Set col = New SQLDMO.Column
col.Name = Range("C" & i).Value
col.DataType = Trim$(Range("D" & i).Value)
col.Properties.UserData
If Len(Range("E" & i).Value) > 0 Then
col.Length = Val(Range("E" & i).Value)
End If
If Len(Range("F" & i).Value) > 0 Then
col.AllowNulls = True
End If
If Len(Range("G" & i).Value) > 0 Then
kk.KeyColumns.Add col.Name
End If
If Len(Range("H" & i).Value) > 0 Then
uk.KeyColumns.Add col.Name
End If
If Len(Range("I" & i).Value) > 0 Then
col.DRIDefault.Text = Range("I" & i).Value
End If
If LCase(col.DataType) = "numeric" And col.Length > 4 Then
col.NumericPrecision = col.Length
col.NumericScale = 2
End If
tb.Columns.Add col"

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-07-16 : 14:15:54
This col.Properties.UserData something numeric...

- Vit
Go to Top of Page
   

- Advertisement -