sql—在使用表值参数调用存储过程时,在python(pymssql)中找不到数据类型< datatype>

rlcwz9us  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(196)

我在调用接受表值参数的存储过程时遇到这个错误。我正在使用pymssqlpython库连接到mssqlserverdb。下面是代码片段。

query = '''
            DECLARE @coltvp1 AS ColType;
            INSERT INTO @coltvp1 (columnName)
            SELECT 'Language' UNION SELECT 'Browser'
            DECLARE @FilterTVP1 AS filterType;
            INSERT INTO @FilterTVP1 (tblname,colname ,value )
            SELECT 'Geo', 'Country','japan' UNION SELECT 'Geo', 'Country','Malaysia' UNION SELECT `'Geo', 'Country','South Korea' UNION SELECT 'Pov', 'PurposeOfVisitHierarchyLevel2','Account' UNION SELECT 'Pov', 'PurposeOfVisitHierarchyLevel2','Purchase' UNION SELECT 'Segment', 'Segment','All' UNION SELECT 'Site', 'SiteLevel2','Dell EMC' UNION SELECT 'Site', 'SiteLevel2','Dell Technologies Cloud' UNION SELECT 'Site', 'SiteLevel2','Dell Technologies Other'`
            Declare @Process_Name VARCHAR(4000) = 'CSAT'
            ,@PageNumber INT = 1
            ,@PageSize INT  = 100
            ,@Start_Date DATETIME  = '2018-01-01 00:00:00'
            ,@End_Date DATETIME  = '2018-01-10 00:59:59'
            ,@Attribute_List NVARCHAR(MAX) = '*'
            ,@TotalCount BIGINT
            exec API_Extract @coltvp1,
                             @FilterTVP1,
                             @Process_Name,
                             @PageNumber,
                             @PageSize,
                             @Start_Date,
                             @End_Date,
                             @Attribute_List,
                             @TotalCount OUTPUT
                             select @TotalCount as TotalCount
'''
conn = pymssql.connect(host, user, password, database, as_dict=True)
cursor = conn.cursor()
cursor.execute(query)
resultset = cursor.fetchall()
print(resultset)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题