You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have following working code that successfully inserted 10K records into SQL Server using Table Valued Parameter (TVP). When I run the code with 400K records, I got error ""ProgrammingError" ('Type mismatch between TVP row values', 'HY000')". How to resolve this?
f = open('C:/Source/test_public.pem', 'rb')
f1 = open('C:/Source/test_private.pem', 'rb')
public = RSA.importKey(f.read())
private = RSA.importKey(f1.read())
I have following working code that successfully inserted 10K records into SQL Server using Table Valued Parameter (TVP). When I run the code with 400K records, I got error ""ProgrammingError" ('Type mismatch between TVP row values', 'HY000')". How to resolve this?
import pyodbc
from datetime import datetime
def main():
now_MainStart = datetime.now()
print(now_MainStart)
f = open('C:/Source/test_public.pem', 'rb')
f1 = open('C:/Source/test_private.pem', 'rb')
public = RSA.importKey(f.read())
private = RSA.importKey(f1.read())
cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};Server=dataserver;UID=UserName;PWD=Passwrd;Database=MySQLServerDB;")
dfInput = pd.read_sql('exec dbo.usp_Temp_GetAllUsers ?', cnxn, params=['None'] )
df_Store = pd.DataFrame(columns=['PatientText', 'EncryptedResult'])
for index, row in dfInput.iterrows():
y = row['PatientText']
message = base64.b64encode(y.encode("utf-8"))
dataNew = base64.b64decode(message)
now_EncryptionDone = datetime.now()
print(now_EncryptionDone)
try:
cursor = cnxn.cursor()
result_array = cursor.execute("EXEC dbo.usp_InsertUsers ?", [df_Store.values]).fetchall()
cursor.commit() #very important to commit
#print(result_array)
except Exception as ex:
print("Failed to execute SP with TVPt")
print("Exception: [" + type(ex).name + "]", ex.args)
if name== "main":
main()
The text was updated successfully, but these errors were encountered: