microsoft / microsoft/sql-server-samples
Access Denied while running Python script from SQL Server
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- PowerShell
- Sterne
- 11.2k
- Forks
- 9.1k
- Ø Merge
- 2 T. 7 Std.
- Gemergte PRs (30 T.)
- 14
Beschreibung
Hi,
I am tring to execute the below query and getting error as Access denied,
Can you please help me to fix this error.
DECLARE @PATH NVARCHAR(4000) = 'D:\SAP_Download\TPM_MATERIAL_MASTER_20191209_101848.txt'
DECLARE @CMDSQL NVARCHAR(4000) = 'Cmd.exe /S /C " "D:\SAP_Download\BatchFile.bat" "D:\SAP_Download\TPM_MATERIAL_MASTER_20191209_101848.txt""'
Exec master..xp_cmdshell @CMDSQL
In .bat file the below code
@ECHO OFF
SET "fileName=%1"
"C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe" "D:\SAP_Download\convertFileFormat.py" %fileName%
And in python file,
import time
import sys
import codecs
import os
myfile = codecs.open(sys.argv[1], encoding='utf-8')
marylines = myfile.readlines()
myfile1 = codecs.open(sys.argv[1], 'w', encoding='utf-16')
for line in marylines:
myfile1.write(line)
myfile1.close()
myfile.close()
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Aufruf von xp_cmdshell und BatchFile.bat. Untersuchen Sie anschließend convertFileFormat.py und den Pfad zur Python-Executable. Reproduzieren Sie den Befehl unter dem SQL Server-Dienstkonto und ermitteln Sie, welcher Schritt Access denied zurückgibt; es ist kein Repository-Test oder Akzeptanzkriterium angegeben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python, sql
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100