Friday, February 24, 2012

IS NULL in SQL statement

Hi,
I am trying to update a table where a field is set to null. The query is:
UPDATE U_segment
SET SEGMENT = '2A-Legacy Pledges Committed-MULTI'
FROM U_segment
INNER JOIN U_T_STEP02A
ON U_segment.REF = U_T_STEP02A.REF
WHERE U_segment.SEGMENT ISNULL
It's not liking it at all.
Any help would be appreciated
Rob> WHERE U_segment.SEGMENT ISNULL
Above should be:
WHERE U_segment.SEGMENT IS NULL
Note the space between the words IS and NULL.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Robert" <Robert@.discussions.microsoft.com> wrote in message
news:DB39722D-833F-4C99-8F8A-E219E002A6DA@.microsoft.com...
> Hi,
> I am trying to update a table where a field is set to null. The query is:
> UPDATE U_segment
> SET SEGMENT = '2A-Legacy Pledges Committed-MULTI'
> FROM U_segment
> INNER JOIN U_T_STEP02A
> ON U_segment.REF = U_T_STEP02A.REF
> WHERE U_segment.SEGMENT ISNULL
> It's not liking it at all.
> Any help would be appreciated
> Rob|||"IS NULL" --> "IS[thisisablank]NULL"
ISNULL is a function which has a signature like ISNULL(Expression,
Valueifexpressionisnull).
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Robert" <Robert@.discussions.microsoft.com> schrieb im Newsbeitrag
news:DB39722D-833F-4C99-8F8A-E219E002A6DA@.microsoft.com...
> Hi,
> I am trying to update a table where a field is set to null. The query is:
> UPDATE U_segment
> SET SEGMENT = '2A-Legacy Pledges Committed-MULTI'
> FROM U_segment
> INNER JOIN U_T_STEP02A
> ON U_segment.REF = U_T_STEP02A.REF
> WHERE U_segment.SEGMENT ISNULL
> It's not liking it at all.
> Any help would be appreciated
> Rob|||I think you need to have space between IS and NULL -> IS NULL instead of
ISNULL
Regards
Steen
"Robert" <Robert@.discussions.microsoft.com> skrev i en meddelelse
news:DB39722D-833F-4C99-8F8A-E219E002A6DA@.microsoft.com...
> Hi,
> I am trying to update a table where a field is set to null. The query is:
> UPDATE U_segment
> SET SEGMENT = '2A-Legacy Pledges Committed-MULTI'
> FROM U_segment
> INNER JOIN U_T_STEP02A
> ON U_segment.REF = U_T_STEP02A.REF
> WHERE U_segment.SEGMENT ISNULL
> It's not liking it at all.
> Any help would be appreciated
> Rob

No comments:

Post a Comment