Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. sql procedure

sql procedure

Scheduled Pinned Locked Moved Database
database
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thanusree Duth
    wrote on last edited by
    #1

    SELECT DISTINCT ISNULL(CONVERT(VARCHAR,DR_TimeIn,103),'NOT CHECKED')AS DATE, DR_EmployeeID AS EMPID , EM_FirstName +' '+ isnull(EM_MiddleName,' ' )+' '+isnull(EM_LastName,' ') AS EMPNAME, FROM SG_Daily_Register to accept the null values of lastname and firstname...I used the 'isnull' which is not correct..Pls correct the procedure

    C L S J 4 Replies Last reply
    0
    • T Thanusree Duth

      SELECT DISTINCT ISNULL(CONVERT(VARCHAR,DR_TimeIn,103),'NOT CHECKED')AS DATE, DR_EmployeeID AS EMPID , EM_FirstName +' '+ isnull(EM_MiddleName,' ' )+' '+isnull(EM_LastName,' ') AS EMPNAME, FROM SG_Daily_Register to accept the null values of lastname and firstname...I used the 'isnull' which is not correct..Pls correct the procedure

      C Offline
      C Offline
      CitrusTech
      wrote on last edited by
      #2

      Which database are we using here? SQL Server does have an isnull function. For oracle checkout nvl. And for mysql I found this discussion of ifnull http://forums.mysql.com/read.php?98,198593

      Data Quality Tools and Data Profiling software

      1 Reply Last reply
      0
      • T Thanusree Duth

        SELECT DISTINCT ISNULL(CONVERT(VARCHAR,DR_TimeIn,103),'NOT CHECKED')AS DATE, DR_EmployeeID AS EMPID , EM_FirstName +' '+ isnull(EM_MiddleName,' ' )+' '+isnull(EM_LastName,' ') AS EMPNAME, FROM SG_Daily_Register to accept the null values of lastname and firstname...I used the 'isnull' which is not correct..Pls correct the procedure

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Try COALESCE instead of ISNULL

        1 Reply Last reply
        0
        • T Thanusree Duth

          SELECT DISTINCT ISNULL(CONVERT(VARCHAR,DR_TimeIn,103),'NOT CHECKED')AS DATE, DR_EmployeeID AS EMPID , EM_FirstName +' '+ isnull(EM_MiddleName,' ' )+' '+isnull(EM_LastName,' ') AS EMPNAME, FROM SG_Daily_Register to accept the null values of lastname and firstname...I used the 'isnull' which is not correct..Pls correct the procedure

          S Offline
          S Offline
          slam Iqbal
          wrote on last edited by
          #4

          SELECT DISTINCT DECODE(DR_TimeIn, NULL,'NOT CHECKED',DR_TimeIn) as Date,
          .............;

          If you are using Oracle DECODE if the best. OR for other Database Server:

          SELECT IIf(TimeIn is null,'NOT CHECKED',TimeIn) AS [Date],
          ........;

          :thumbsup:

          1 Reply Last reply
          0
          • T Thanusree Duth

            SELECT DISTINCT ISNULL(CONVERT(VARCHAR,DR_TimeIn,103),'NOT CHECKED')AS DATE, DR_EmployeeID AS EMPID , EM_FirstName +' '+ isnull(EM_MiddleName,' ' )+' '+isnull(EM_LastName,' ') AS EMPNAME, FROM SG_Daily_Register to accept the null values of lastname and firstname...I used the 'isnull' which is not correct..Pls correct the procedure

            J Offline
            J Offline
            Jeremy Hutchinson
            wrote on last edited by
            #5

            It looks like you just forgot to wrap EM_FirstName in an isnull. Otherwise I don't see why that wouldn't work with MSSQL.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups