if the value of the field after select is nothing then the value = 00

  • help to do this

    if the value of the field "[val]" is nothing then the value field "[val]"  =00

    ---------------

    INSERT INTO [pitable].[dbo].[Table1]([val],[uu],[col])

    SELECT *

    FROM OPENQUERY(pcntn, 'SELECT value as val ,''UNIT1''as uu ,''FF9900'' AS col FROM picomp WHERE time = date(''*'') AND tag = ''a1mp340''

    -------------------------------

    i wont to do this because sometimes connection to the link server is busy

    thnks  ilan

  • ISNULL(val, '00') ???



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • how can i do this

    select

    CASE

    SELECT *

    FROM OPENQUERY(pcntn, 'SELECT value as val ,''UNIT1''as uu ,''FF9900'' AS col FROM picomp WHERE time = date(''*'') AND tag = ''a1mp340''

    ------------"if the value of "val"= null

    -----------then  insert into "val" value "0"

    INSERT INTO [pitable].[dbo].[Table1]([val=0],[uu],[col])

    CASE

    SELECT *

    FROM OPENQUERY(pcntn, 'SELECT value as val ,''UNIT1''as uu ,''FF9900'' AS col FROM picomp WHERE time = date(''*'') AND tag = ''a1mp340''

    "if the value of "val"=  not null

    then  insert

    INSERT INTO [pitable].[dbo].[Table1]([val],[uu],[col])

    ----------------------------------------------------------

    can you hlep my put it all ?????

    thnks ilan

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

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