为什么在SQL Server中@ input_data_1限制为128个字符?

时间:2019-03-20 14:57:28

标签: sql-server

根据文档,它应该是varchar(max),大约20亿个字符。但是这个查询:

EXECUTE sp_execute_external_script
""@language =N'R',
@input_data_1 ="select ptid, mridate, age, male, race, weight, height, packyrs, yrsqui, talcoh, physact, chf, chd, stroke, diabet, genhlth, ldl, alb, crt, plt, sbp, aai, fev, dsst, atrophy, whgrd, numinf, volinf, obstime, death from dbo.testpython",
@script=N'
dead = 0
notDead=0
for v in InputDataSet["a.death"]:
    if v==0:
        notDead=notDead+1
    else:
        dead=dead+1
d={"dead":[dead], "notDead":[notDead]}
OutputDataSet=pandas.DataFrame(data=d)'
WITH RESULT SETS (([Dead] int,[not dead] int));'

显示此错误:

  

Msg 103,Niveau 15,État4,Ligne 43
  以“ select ptid,mridate,年龄,男性,种族,体重,身高,packyrs,yrsqui,talcoh,physact,chf,chd,中风,糖尿病,genhlth,ldl”开头的标识符过长。最大长度为128。

您知道原因是什么吗?我正在使用SQL Server Express。会相关吗?

谢谢

1 个答案:

答案 0 :(得分:0)

尝试用(')代替(“)

@input_data_1 =N'select ptid, mridate, age, male, race, weight, height, packyrs, yrsqui, talcoh, physact, chf, chd, stroke, diabet, genhlth, ldl, alb, crt, plt, sbp, aai, fev, dsst, atrophy, whgrd, numinf, volinf, obstime, death from dbo.testpython',