Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 case statement syntax

Author  Topic 

geraldjr30
Starting Member

5 Posts

Posted - 2014-06-11 : 13:08:12
hi. getting the following error message:

Msg 156, Level 15, State 1, Line 123
Incorrect syntax near the keyword 'is'.
Msg 319, Level 15, State 1, Line 143
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
Msg 319, Level 15, State 1, Line 144
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
Msg 319, Level 15, State 1, Line 146
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.


using this syntax:
...
,case
when
LEFT(LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12))))),
CHARINDEX(' ', LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))))))
is null
and
right
(LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(rms.nm12) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12))))), --FIRST TEMP
len(LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))))) -
CHARINDEX(' ', LTRIM(SubString(rms.nm12,
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12))))))
is not null
then ''
else
right
(LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(rms.nm12) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12))))), --FIRST TEMP
len(LTRIM(SubString(ltrim(rtrim(rms.nm12)),
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))))) -
CHARINDEX(' ', LTRIM(SubString(rms.nm12,
CHARINDEX(' ', ltrim(rtrim(rms.nm12)))+1,
len(ltrim(rtrim(rms.nm12))) -
CHARINDEX(' ', ltrim(rtrim(rms.nm12))))))
end as middletest


can someone please help me correct the case statement?

thanks in advance

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-11 : 13:10:43
Locking this duplicate topic. Please see my reply to your other post.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -