Home > Backend Development > PHP Tutorial > SQL statement to obtain all table information_PHP tutorial

SQL statement to obtain all table information_PHP tutorial

WBOY
Release: 2016-07-13 17:02:06
Original
869 people have browsed it

exec sp_MSForEachTable
@precommand=N'
create table ##(
id int identity,
table name sysname,
number of fields int,
number of records int,
reserved Space Nvarchar(10),
used space varchar(10),
index used space varchar(10),
unused space varchar(10))',
@command1=N'insert # #(Table name, number of records, reserved space, used space, index used space, unused space) exec sp_spaceused ''?''
update ## set number of fields=(select count(*) from syscolumns where id= object_id(''?'')) where id=scope_identity()',
@postcommand=N'select * from ## order by id drop table ##'


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631080.htmlTechArticleexec sp_MSForEachTable @precommand=N' create table ##( id int identity, table name sysname, field number int, Record number int, reserve space Nvarchar(10), use space varchar(10), index use...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template