Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

I get the following error when trying to use bulk_update. #10

Open
Taikono-Himazin opened this issue Jun 6, 2023 · 0 comments
Open

Comments

@Taikono-Himazin
Copy link

Taikono-Himazin commented Jun 6, 2023

Error when trying to use bulk_update

I get the following error when trying to use bulk_update.

Column, parameter, or variable #16: Cannot find data type 1998.0000001

I've inspected my model etc. and it looks fine.
save() does not cause any problems.
When I tried to output the SQL as well, it became as follows.
I have mssql-django installed to support SQLServer.

UPDATE [dbo_TableA] 
SET
    [col1] = CASE 
        WHEN ( 
            [dbo_TableA].[PK1] = 00000001
            AND [dbo_TableA].[PK2] = 1998
        ) 
            THEN 4
        ELSE NULL 
        col2
    , [col2] = CASE 
        WHEN ( 
            [dbo_TableA].[PK1] = 00000001 
            AND [dbo_TableA].[PK2] = 1998
        ) 
            THEN 99
        ELSE NULL 
        END
    , [col3] = CASE 
        WHEN ( 
            [dbo_TableA].[PK1] = 00000001 
            AND [dbo_TableA].[PK2] = 1998
        ) 
            THEN 10001 
        ELSE NULL 
        END
    , [col4] = CASE 
        WHEN ( 
            [dbo_TableA].[PK1] = 00000001 
            AND [dbo_TableA].[PK2] = 1998
        ) 
            THEN 04382
        ELSE NULL 
        END
    , [col5] = CASE 
        WHEN ( 
            [dbo_TableA].[PK1] = 00000001 
            AND [dbo_TableA].[PK2] = 1998
        ) 
            THEN bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00')
        ELSE NULL 
        END 
WHERE
    ([dbo_TableA].[PK1], [dbo_TableA].[PK2]) IN (00000001, 1998)

Do you have any solution?
thank you.

environment
django 3.2.19
mssql-django 1.3
django-compositepk-model 1.0.2
ODBC Driver 18 for SQL Server
SQLServer 2017

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant