I'm just interested in getting the schema of a table because I want to generate an SQL Script that will create the table someplace else with just CREATE TABLE... Now before someone suggest that I use Server Management Objects that's not the answer to this particular question.
I do this.
sqlda.SelectCommand.CommandText = "SELECT * FROM " + kingTable.Name;
sqlda.MissingSchemaAction = System.Data. MissingSchemaAction.AddWithKey;
sqlda.FillSchema( kingTable, System.Data. SchemaType.Source );
Then I do this.
kingTable.Columns[ "hash" ].MaxLength;
This doesn't work. I know it shouldn't work because MaxLength is really just for strings or so it says in the documentation. However, how do I find out what the length of this field is
In the database it's a BINARY column with a fixed size of 17. So how do I find out that number 17 in code without using the sys.columns table
Thanks,
.NET Development36
|