tedious icon indicating copy to clipboard operation
tedious copied to clipboard

datetime2 parameter option: precision instead of scale

Open devcrev opened this issue 3 years ago • 2 comments

SQL Server documentation refers to the precision of the datetime2 data type not the scale. For Tedious the scale option is used when defining a datetime2 parameter. E.g., options: {scale: 7}

From: https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime2-transact-sql?view=sql-server-2017... image

devcrev avatar Oct 21 '21 20:10 devcrev

More information:

Also note querying the INFORMATION_SCHEMA.COLUMNS for a particular table reveals a column named DATETIME_PRECISION.

E.g., Run SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='SampleTable' and substitute 'SampleTable' with a table that contains a datetime2 column.

Scale is only related to the Numeric/Decimal type.

Upon fixing this please consider adding to the "Supported datatypes" documentation that states "For datetime2 input parameters, default precision is 7".

devcrev avatar Oct 22 '21 00:10 devcrev

Hi @devcrev, thanks for bringing this up. Let me look into this and get back to you. I do recall this has been brought up before, and there may be also a fix or explanation laying around somewhere.

MichaelSun90 avatar Oct 26 '21 17:10 MichaelSun90