SELECT DateTime, Skill, Name, TimeZone, ID, User, Employee, Leader
FROM t_Agent_Skill_Group_Half_Hour AS t
I need to view the table structure in a query.
- The structure of a table can be viewed using the DESCRIBE TABLE_NAME command. - Provides a description of the specified table or view. For a list of tables in the current schema, use the Show Tables command. - For a list of views in the current schema, use the Show Views command.
Get view properties by using Object ExplorerIn Object Explorer, select the plus sign next to the database that contains the view to which you want to view the properties, and then click the plus sign to expand the Views folder. Right-click the view of which you want to view the properties and select Properties.
To show the schema, we can use the DESC command. This gives the description about the table structure.
For SQL Server, if using a newer version, you can use
select *
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME='tableName'
There are different ways to get the schema. Using ADO.NET, you can use the schema methods. Use the DbConnection
's GetSchema
method or the DataReader
'sGetSchemaTable
method.
Provided that you have a reader for the for the query, you can do something like this:
using(DbCommand cmd = ...)
using(var reader = cmd.ExecuteReader())
{
var schema = reader.GetSchemaTable();
foreach(DataRow row in schema.Rows)
{
Debug.WriteLine(row["ColumnName"] + " - " + row["DataTypeName"])
}
}
See this article for further details.
sp_help tablename
in sql server
desc tablename
in oracle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With