title: SQL: ISNULL function with different type of parameters
body: <p>In SQL Server, <a href="http://msdn.microsoft.com/en-us/library/aa933210%28v=sql.80%29.aspx" rel="nofollow">ISNULL()</a> function has to same type of parameters. </p>
  
  <blockquote>
    <p>check_expression</p>
    
    <p>Is the expression to be checked for NULL. check_expression can be of
    any type.</p>
    
    <p>replacement_value</p>
    
    <p>Is the expression to be returned if check_expression is NULL.
    replacement_value <strong>must have the same type as check_expresssion</strong>.</p>
  </blockquote>
  
  <p>How can I use it with different type of parameter? I want to use with <code>date</code> and <code>string</code> parameter like this <code>ISNULL(A.DATE, '-')</code></p>
  
  <p><strong>NOTE</strong>: Type of <code>A.DATE</code> is <code>datetime</code>.</p>
  
  <p><strong>EDIT-1</strong>: My full query which is getting 0 row:</p>
  
  <pre><code>    SELECT A.pkey as KREDİ, A.SUMMARY , D.BayiStatu AS STATU, D.Sorumlu AS SORUMLU, C.BayiSonuc as SONUC, ISNULL( CONVERT(VARCHAR(25), A.CREATED, 112) , '-' ), ISNULL( CONVERT(VARCHAR(25), A.RESOLUTIONDATE, 112) , '-' ), dbo.CUSTVAL(11931, A.ID, 'S') AS BAYİ, ISNULL( CONVERT(VARCHAR(25), dbo.GetLastStatuTime(A.ID), 112) , '-' ) AS SON_STATU_TAR,j2.SUMMARY, ISNULL( CONVERT(VARCHAR(25), j2.CREATED, 112) , '-' ), ISNULL( CONVERT(VARCHAR(25), j2.RESOLUTIONDATE, 112) , '-' ), j3.SUMMARY, ISNULL( CONVERT(VARCHAR(25), j3.CREATED, 112) , '-' ), ISNULL( CONVERT(VARCHAR(25), j3.RESOLUTIONDATE, 112) , '-' )
  FROM AspNetServicesDB.dbo.SONUC_MAP C, JİRA.resolution E, jira.issuestatus B, AspNetServicesDB.dbo.STATU_MAP D, Jira.jiraissue A
  INNER JOIN Jira.issuelink i
      ON i.SOURCE = A.ID and i.SEQUENCE = 0
  INNER JOIN Jira.jiraissue As j2
      ON i.DESTINATION =j2.ID 
  LEFT JOIN Jira.issuelink i2 
      ON i2.SOURCE = A.ID  and i2.SEQUENCE = 1
  LEFT JOIN Jira.jiraissue As j3 
      ON i2.DESTINATION = j3.ID
  WHERE A.issuestatus = B.ID
  AND 'BAŞARAN OTOMATİV' = dbo.CUSTVAL(11931, A.ID, 'S')
  AND B.pname = D.JiraStatu collate Turkish_CS_AI
  AND A.issuetype != 11
  AND A.RESOLUTION = E.ID
  AND E.pname = C.JiraSonuc collate Turkish_CS_AI
  </code></pre>
  
  <p><strong>EDIT-2</strong>: But this working</p>
  
  <pre><code>select ISNULL( CONVERT(VARCHAR(25), A.RESOLUTIONDATE, 112) , '-' )
  FROM Jira.jiraissue A
  </code></pre>
  
  <p>Could be the reason <code>JOIN</code> ?</p>