sqlserver与mysql的一些不同的TSQL语句

1、查询所有数据库名
mysql写法:show databases;
sqlserver写法:select * from sys.databases;
2、根据数据库名查询所有表名
mysql写法: show tables;
sqlserver写法:use database select name from sys.objects where type='U'; //其中database为需要查找的数据库名
3、根据表查询该表所有字段
mysql写法:show columns from table;
sqlserver写法:select name from syscolumns where id=Object_Id('table'); //table为表名

原文地址:https://www.cnblogs.com/luodao1991/p/3112783.html