April 18, 2019 at 12:00 am
Comments posted to this topic are about the item A Quick Start to Running Python Code in SQL Server
April 20, 2019 at 2:49 pm
Hi Emmitt,
I'm having a little trouble getting the following to run. I suspect the table Result1 table should already exist for it to insert the output generated.
Any hints on the table creation requirement here?
DECLARE @InputQuery NVARCHAR(2000) = N'
SELECT n from (values (1), (2), (3)) a(n)
'
INSERT dbo.Result1
EXEC sp_execute_external_script
@language =N'Python',
@script=N'OutputDataSet = InputDataSet',
@input_data_1 = @InputQuery
April 22, 2019 at 4:38 pm
I believe this is standard SQL from reading the article. This is INSERT..EXEC, so the table would need to exist.
October 24, 2019 at 11:14 am
Hi Emmitt
Great article. I have a question regarding the first script. Why are the numbers in the outcome
1
3
5
9
7
appearing in that order? Shouldn't 7 come before 9? I find that quite weird.
Best
Stelios
October 24, 2019 at 11:27 am
There is no ordering guarantee for the numbers when they are in a set
https://stackoverflow.com/questions/9792664/converting-a-list-to-a-set-changes-element-order
November 13, 2020 at 5:21 pm
Good article, thank you...
Note: In the one example you're missing the column name;
DECLARE @InputQuery NVARCHAR(2000) = N'
SELECT n, o
FROM (values (1,10), (2,20), (3,30)) a(n, o)
'
EXEC sp_execute_external_script
@language =N'Python',
@script=N'OutputDataSet = InputDataSet',
@input_data_1 = @InputQuery
WITH RESULT SETS
( ( [MissingColumnName] INT NOT NULL,
[iplusTen] INT NULL)
)
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply