SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 case statement syntax
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

geraldjr30
Starting Member

USA
5 Posts

Posted - 06/11/2014 :  13:08:12  Show Profile
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

USA
36895 Posts

Posted - 06/11/2014 :  13:10:43  Show Profile  Visit tkizer's Homepage
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
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000