You are here: Problem with case expression « MsSQL Server « IT news, forums, messages
Problem with case expression

Posted by chudson007 on 09/30/05 12:02

In the Portal1 case expression in the script at the bottom I would like
to replace where the result 1 is returned, with the substring function
returned as Portal

{SUBSTRING(Field1, CHARINDEX('tonep', Field1) + 4, (CHARINDEX('.txt',
Field1) - 8) - (CHARINDEX('tonep', Field1) + 4))}

However, I am experiencing errors. I think it is because The substring
function will not return a number as the case expression expects so I
must incorporate cast or convert, but do not know how. Can you help???




SELECT portal1 = CASE WHEN len(Field1) > 5 THEN 1 ELSE '' END,
SUBSTRING(Field1, CHARINDEX('tonep', Field1) + 4, (CHARINDEX('.txt',
Field1) - 8)
- (CHARINDEX('tonep', Field1) + 4)) AS portal,
Table.*
FROM Table

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация