Solved

Problem in cast in sql

Posted on 2014-10-01
1
185 Views
Last Modified: 2014-10-01
Query : select firstname, case when ProjectName Is Null Then 0 else ProjectName  end  from EmployeeTable
Left join
Projectdeatil on EmployeeTable.Employeeid = Projectdeatil.EmployeeDetailID order by firstname

Error:   Conversion failed when converting the varchar value 'Task Track' to data type int.
0
Comment
Question by:satmisha
1 Comment
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40354860
Change it to:

select firstname, case when ProjectName Is Null Then '0' else ProjectName  end  from EmployeeTable 
 Left join 
 Projectdeatil on EmployeeTable.Employeeid = Projectdeatil.EmployeeDetailID order by firstname 

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Duplicating MySQL Table columns 5 45
Complex SQL statement in VB.NET 7 31
Currency in SQL? 2 31
Coldfusion/Mysql page error related to dynamic table creation. 9 33
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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