MsSQL Version of “Show Tables”
MySQL has an easy command that places a list of all tables found within the active database into the result set. I have recently been working on a project for my job which requires me to use MsSQL as the database.
I find MySQL and MsSQL to be very similar in terms of syntax, but I think MySQL takes the crown. I believe it’s much more dynamic, like having the ability to use the “ORDER” command within the where clause of a select statement. Not to mention all of the trouble I’ve had with the datetime data type, which has been hell for me when making stored procedures.
I must say, stored procedures are an easy way to allow a person remote access to your data without the risk of having a malicious script eating your bandwidth or messing with your data.
Onto my short tip of the day. One of the first things that most people learn about MySQL is the “show tables;” command. It is always nice to be able to produce a list of all tables that have been created. With MsSQL, it’s a bit different; much harder, in fact. Here’s the code:
SELECT name
FROM database name..sysobjects
WHERE xtype = ‘U’;
The result set will contain a list of table names currently found within the database specified in the FROM clause. This will only list the user tables, and will not look into system tables or stored procedures. Hope that helps.
Related Articles:
- How to Get the Number of Rows in a MySQL Result Resource Using PHP MySQL is a flexible database engine, and today I’m going to discuss ways to fetch the number of rows in...
- A New Milestone in Development | Fortress RPG I knew from the very beginning that the Technology section of the game was going to be HUGE, but I...