• 2024-03-07sql server 查询所有表的记录条数
    DECLARE@tableNameNVARCHAR(MAX)DECLARE@sqlNVARCHAR(MAX)=''CREATETABLE#TempTable(TableNameSYSNAME,RowCountsBIGINT)--遍历所有用户表DECLARETableCursorCURSORFORSELECTt.NAMEFROMsys.tablestWHEREt.is_ms_shipped=0--过滤掉系统表ANDt.na
  • 2023-11-17SqlServer中获取数据库中每个表的行数
    SqlServer中获取数据库中每个表的行数CREATETABLE#RowCounts(NumberOfRowsBIGINT,TableNameVARCHAR(128))EXECsp_MSForEachTable'INSERTINTO#RowCountsSELECTCOUNT_BIG(*)ASNumberOfRows,''?''asTableNameFROM?'SELECTTableName,Numbe
  • 2023-10-11SqlServer中获取数据库中每个表的行数
    SqlServer中获取数据库中每个表的行数CREATETABLE#RowCounts(NumberOfRowsBIGINT,TableNameVARCHAR(128))EXECsp_MSForEachTable'INSERTINTO#RowCountsSELECTCOUNT_BIG(*)ASNumberOfRows,''?''asTableNameFROM?'SELECTTableName,Num