0

I am trying to update a table in a server(ServerA) using a linked share connection from ServerB and i Got the below Error

The OLE DB provider "SQLNCLI10" for linked server "ServerA" could not UPDATE table "[ServerA].[MyDb].[dbo].[tbl_name]" because of column "CreateDt". Conversion failed because the data value overflowed the data type used by the provider.

This is the query I Used :

update [ServerA].[MyDb].[dbo].[tbl_name]  
set transfer_fl = 1, 
    CreateDt = getdate()  
where transfer_fl<>'1'

the column CreateDt is of data type smalldatetime and it already has a value in it.

Can somebody give explain me why this happens.

4
  • i don't have much ideal but below link seems helpful stackoverflow.com/questions/20388927/… Commented Jul 25, 2015 at 11:59
  • Are your server and linked server both Sql Server? Commented Jul 25, 2015 at 12:17
  • Yes. Both of them are on SQL Server 2008 R2 Commented Jul 25, 2015 at 12:19
  • Is transfer_fl interger 1 or string '1' Commented Jul 25, 2015 at 12:27

2 Answers 2

1

This is a bug in SQL 2008/R2.

https://connect.microsoft.com/SQLServer/feedback/details/430745/sql-server-2008-unexpected-behavior-when-inserting-datetime-value-in-smalldatetime-column-on-a-linked-server

Unluckily it is marked as won't fix and you would have to do an explicit conversion.

Sign up to request clarification or add additional context in comments.

Comments

0

GETDATE (Transact-SQL)

Sintaxis

GETDATE ( )

Tipo de valor devuelto

datetime

no smalldatetime

Here is more detail explain of the SQL Server Error Messages - Msg 298

1 Comment

GETDATE() can actually be assigned to a smalldatetime field. you could try to assign it to a smalldatetime variable in SSMS. Even your link said that dates outside of 1900-2079 will pose problem. The problem only happens on linked server in SQL2008.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.