检查MS SQL Server正在运行还是存在?

时间:2019-05-16 10:32:56

标签: python sql-server python-3.x pandas sqlalchemy

如何使用脚本检查MS SQL Server运行或存在。 我下面有脚本,对脚本不满意,是否有任何明智的查找方法?

from sqlalchemy import create_engine
from sqlalchemy import inspect

MSSQL_ServerName = 'DESKTOP-R27RCUDD'

try:
    Driver = 'driver=SQL Server Native Client 11.0';
    engine = create_engine('mssql+pyodbc://' + MSSQL_ServerName + '/master?' + Driver)
    Inspector = inspect(engine)
except:
    print('SQL Server NOT Found')

0 个答案:

没有答案