I'm using the code below to show the tables in my database.
I get "Connected to database" but nothing else. Is my code correct? can I use another way to get the info I need?
<?php
$link = mssql_connect('HOST', 'user', 'pass');
if (!$link || !mssql_select_db('dbname', $link)) {
die('Unable to connect or select database!');
}else{
echo"Connected to database";
}
$v = mssql_query("Select name from sysobjects where type like 'u'");
$row = mssql_fetch_array($v);
echo "<br>"; echo $row[0]; echo "<br>";
mssql_free_result($v);
?>
MySQL SHOW TABLES command example To use the SHOW TABLES command, you need to log on to the MySQL server first. On opening the MySQL Command Line Client, enter your password. Select the specific database. Run the SHOW TABLES command to see all the tables in the database that has been selected.
Using SQL Server Management Studio In Object Explorer, select the table for which you want to show properties. Right-click the table and choose Properties from the shortcut menu. For more information, see Table Properties - SSMS.
The following is the output that displays all the tables in the database "business". In the above, we have 132 tables in the database business. To check the count of tables. mysql> SELECT count(*) AS TOTALNUMBEROFTABLES -> FROM INFORMATION_SCHEMA.
Alternate way, also fetches schema name
SELECT TABLE_CATALOG ,
TABLE_SCHEMA ,
TABLE_NAME ,
TABLE_TYPE
FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM sys.Tables;
Should do the magic :-D
And if u want to see all columns, i would do
SELECT TOP 1 * From Tablename;
so u'll get one row with all Columns, its not perfect but it does the trick if u just want to know sth
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