Exec Code Python in sql in foreground

Lic. Carlitos Garrido 1 Reputation point

Hi EveryBody, in first place i send my apollogies for my bad english.

i have a code in python that open a browser with url X... for example "htttps://www.google.com" y try exec in sql there query this way:

EXECUTE sp_execute_external_script @language = N'Python'
, @script = N'
import webbrowser
webbrowser.BackgroundBrowser("C://Program Files//Google//Chrome//Application//chrome.exe"))

when y type run, the query execute very well in managmetn sql, but the process only showme in the task manager of windows in background.

i need exec in foreground.

i hope can helpme please.

thanks everybody!!!!!

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,897 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 102.3K Reputation points

    No, you cannot do that. SQL Server runs as a service and does not have any desktop. The Python script actually runs in a separate process, but that is also a service, and there is no desktop.

    And overall, you don't want to run things from SQL Server that waits for a long time, because that holds up resources, while SQL Server is waiting for the script to complete.

    0 comments No comments