python 2.7 - How can I query over all db of my server without looping over DB in pymssql connection -
i'd first know how make query on databases in server instance pymssql (in mssql management studio = right click --> new query on server thumbnail don't need specify name of db in query - gives 1 more column in output segment record from). how do same registered servers on 2 or multiple hosts (i have 2 hosts , want pass same query need make 2 connections ?) thanks
you use sp_foreachdb, this:
execute master.sys.sp_msforeachdb 'use [?]; exec update table set foo = bar'
Comments
Post a Comment