HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Why would a SELECT INTO cause an arithmetic overflow?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whyintooverflowselectwouldcausearithmetic

Problem

I am doing this

SELECT * INTO table1 FROM Table0


I get an arithmetic overflow on a datetime column (error converting to smalldatetime), however the destinations schema that got created has a datetime column and not a smalldatetime column..

Solution

It sounds to me like you have an implicit conversion to smalldatetime, probably in a computed column. If you look at the Estimated Execution Plan, you'll probably see Compute Scalar operations in there. Hit F4 to see the properties, and you should be able to see the calculations that are being done, including any implicit conversions that are being used.

Context

StackExchange Database Administrators Q#31265, answer score: 7

Revisions (0)

No revisions yet.