Solved

Conversion failed when converting the varchar value

Posted on 2015-02-11
3
195 Views
Last Modified: 2015-02-11
Dear Experts

select TKN_Dziennik from cdn.TKNag where TKN_Dziennik is not null union
select TrN_Dziennik from cdn.TraNag where TrN_Dziennik is not null union
select TrN_WsDziennik from cdn.TraNag where TrN_WsDziennik 

Open in new window


I got error in Sql Srv "Conversion failed when converting the varchar value 'ZK' to data type tinyint."
what should I do wrong?
do I need to use cast/convert in every line?

thanks
Jarek
0
Comment
Question by:ja-rek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40603066
Since I don't see a CAST( as int) in here, then likely one or more of these objects is a view or table-valued function that has a CAST( as int) in it, and is failing there.
0
 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40603103
You are UNION 3 columns and as result they should have the same datatype. Find which of the columns is TINYINT (TKN_Dziennik, TrN_Dziennik, TrN_WsDziennik) and apply a CAST function on it (CAST ColName AS VARCHAR)
0
 
LVL 1

Author Closing Comment

by:ja-rek
ID: 40603343
thanks for help!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question