May 29, 2008 at 11:01 pm
Hi Guys,Im getting tis error for this,whats wrong in this ?can anybody suggest me?
I am doing UPDATE #temp SET
Fname = LEFT(Logins, CHARINDEX(',', Logins)-1)
Msg 536, Level 16, State 5, Line 1
Invalid length parameter passed to the SUBSTRING function.
The statement has been terminated.
May 29, 2008 at 11:16 pm
You have not passed the start value for the charindex function.
Ex:- CHARINDEX(',', Logins,1)
"Keep Trying"
June 2, 2008 at 8:44 pm
',' is not found in the string so charindex()-1 is returning -1 which is an invalid length.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
June 3, 2008 at 9:16 am
swekik (5/29/2008)
Hi Guys,Im getting tis error for this,whats wrong in this ?can anybody suggest me?I am doing UPDATE #temp SET
Fname = LEFT(Logins, CHARINDEX(',', Logins)-1)
Msg 536, Level 16, State 5, Line 1
Invalid length parameter passed to the SUBSTRING function.
The statement has been terminated.
You need to add:
Where CHARINDEX(',', Logins) > 0
to it.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply