OpenQuery linked server fields all show as Text Datatype

  • I have a linked server(4D) that I have linked using OpenQuery that I created a few views off of to use in CR  some other projects. Working with I have run into an issue where all the fields come across as Text data types making it difficult to convert to things like numeric or money. Is there a better way to connect to the database to preserve its data types or better yet a more efficient way to bring that data over rather than creating views?

  • If you get back all as text, this is because the OLE DB or ODBC driver for 4D does it this way. Or all columns are simply defined as text in 4D. (4D is a product that I am not familiar with at all.) Maybe there is some configuration you can do with the 4D driver, but this is not the forum to ask about that.

    You could add explicit casts to your view definitions to have it encapsulated. If you are on SQL 2012 or later, I recommend that you use try_cast so that you don't choke on bad data.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply