Microsoft SQL Server


User Contributed Notes 11 notes



3
exidas at madnes dot eu4 years ago
$all = MSSQL_Query("select TABLE_NAME, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS order by TABLE_NAME, ORDINAL_POSITION");
$tables = array();
$columns = array();
while($fet_tbl = MSSQL_Fetch_Assoc($all)) { // PUSH ALL TABLES AND COLUMNS INTO THE ARRAY
  $tables[] = $fet_tbl[TABLE_NAME];
  $columns[] = $fet_tbl[COLUMN_NAME];
}
$sltml = array_count_values($tables); // HOW MANY COLUMNS ARE IN THE TABLE
foreach($sltml as $table_name => $id) {
 
 echo "<h2>". $table_name ." (". $id .")</h2><ol>";
 
    for($i = 0; $i <= $id-1; $i++) {
    
    echo "<li>". $columns[$i] ."</li>";
    
    }
    
  echo"</ol>";
 
}


1
bryanpiercecap at gmail dot com1 year ago
function mssql_insert_id() {
    $id = 0;
    $res = mssql_query("SELECT @@identity AS id");
    if ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
        $id = $row["id"];
    }
    return $id;
}




Смотрите также:
Описание на ru2.php.net
Описание на php.ru