I'm looking at creating a basic ORM (purely for fun), and was wondering, is there a way to return the list of tables in a database and also the fields for every table?
Using this, I want to be able to loop through the result set (in C#) and then say for each table in the result set, do this (e.g. use reflection to make a class that will do or contain xyz).
Further to this, what are some good online blogs for SQL Server? I know this question is really about using system SPs and databases in Sql Server, and I am ok with general queries, so I'm interested in some blogs which cover this sort of functionality.
Thanks
Just throwing this out there - easy to now copy/paste into a word or google doc:
I tested a few solutions an found that
gives you the column info for your CURRENT/default database.
, without the < and >, gives you the column info for the database DBNAME.
Your other inbuilt friend here is the system sproc SP_HELP.
sample usage ::
It returns a lot more info than you will really need, but at least 90% of your possible requirements will be catered for.
This will return the database name, table name, column name and the datatype of the column specified by a database parameter:
I found an easy way to fetch the details of Tables and columns of a particular DB using SQL developer.