环境:SQL Server 2008 R2

问题:查询表结构命令

       对MySQL和Oracle数据库熟悉的朋友知道用desc就可以查询一张表的结构,但是在SQL Server里执行desc命令会报错。

 desc Student; --关键字 'desc' 附近有语法错误。

       现提供两条命令查询表结构:

       1.sp_help table_name;

          如: sp_help Student;
       执行效果如下:
     SQL Server里查询表结构命令

      2.sp_columnstable_name;

           如: sp_columns Student;
           执行效果如下:

        SQL Server里查询表结构命令

推荐使用sp_help table_name,因为这条命令查询出的表结构信息更加详细。

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2022-01-08
  • 2021-12-07
  • 2022-12-23
  • 2021-11-07
  • 2021-09-03
  • 2022-01-27
猜你喜欢
  • 2021-11-07
  • 2022-12-23
  • 2021-11-07
  • 2021-05-18
相关资源
相似解决方案