Closed j1yuan closed 1 year ago
@j1yuan You should use pytds.tds_types.BigIntType() instead of INT8TYPE, and SmallDateTimeType() instead of DATETIM4TYPE, etc.
@j1yuan and for flag, you may use the following values: fNullable = 1 fReadWrite = 8
I need the columns to be "not nullable". It feels that the fNullable flag would allow null. How can I specify a "not nullable" flag?
@j1yuan if you check https://github.com/denisenkom/pytds/blob/0e6114d9c1f367c625206b41abfd2760b9856bd7/src/pytds/__init__.py#L981 and https://github.com/denisenkom/pytds/blob/0e6114d9c1f367c625206b41abfd2760b9856bd7/src/pytds/__init__.py#L1001, you will see that flag is not in use at all. Anyways it's an INSERT BULK statement why column flags required? https://learn.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql?view=sql-server-ver16
@j1yuan if you really want to set the column flags, here is the reference
fNullable is a bit flag. Its value is 1 if the column is nullable.
fNullable is at the least significant position so you may put 0 for NOT NULL, and and identity column is 0 | fIdentity
Added some information here https://python-tds.readthedocs.io/en/latest/pytds.html#pytds.tds_base.Column
I am trying to use the copy_to() function, and I don't know how to supply the right values in the "flags" field in preparation of the Column object. Here is my code:
The error message is:
I wonder if anyone can show me a few examples to set the right values in the "flags" field?