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.
| Author |
Topic |
|
challapavan
Starting Member
8 Posts |
Posted - 2007-08-13 : 10:42:17
|
| Hi there when i tried to execute the following query in sql serverselect au_fname,SUBSTRING(P1.au_lname, CHARINDEX('/', P1.au_lname) + 1,CHARINDEX('=', P1.au_lname, 1)-3)AS [Full Name]from authors as P1i will get the error like "Invalid length parameter passed to the substring function."If i remove -3 from there it works fine...Please can anyone clarify this issue.Thank You.pavan |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-08-13 : 10:44:21
|
when charindex() function cannot find the '=' in the string au_lname, it returns 0. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-08-13 : 10:47:36
|
| whats wrong with thisselect P1.au_fname, P1.au_fname+' '+ P1.au_lname as [Full Name] from Authors as P1why are you trying to do it that wayAshley Rhodes |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-14 : 01:50:01
|
| Can you post some sample data with expected outcome?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|