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 |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-12 : 14:18:01
|
| When I execute this query Iam getting an error.Please can somebody suggest me what is wrongServer: Msg 536, Level 16, State 3, Line 1Invalid length parameter passed to the substring function.SELECT F.inc_id,NULL,NULL, SUBSTRING(G.issue_desc,1,CHARINDEX(':', G.issue_desc, 1)-1)as Test, SUBSTRING(G.issue_desc, CHARINDEX(':', G.issue_desc, 1)+1, len(G.issue_desc))as Test2 , G.grade, G.considered_by FROM tbl_info_master F, tbl_issue_master GWHERE F.inc_id=G.emp_id |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-12 : 14:24:00
|
there is a record where CHARINDEX(':', G.issue_desc, 1)=0so that would be a length of -1Corey |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-12 : 14:24:47
|
| IS PATINDEX a solution for this case |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-12 : 14:49:49
|
what case are we talking about? Show me some sample records, and the desired result. I have a feeling patindex won't be necessary... Corey |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-12 : 15:06:02
|
| Got it thanks I used case statement to chek the condition u told me so now it works fine ..Thanks a lot seventhnight... |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-10-12 : 15:34:01
|
no problem... glad i could help Corey |
 |
|
|
|
|
|
|
|