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 |
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2009-12-10 : 20:56:36
|
| Hi therei've a user defined function (it takes string as parameter and returns a table with words) working nicely until i used it on a table where it throwing an error (Invalid length parameter passed to the LEFT or SUBSTRING function.). because am using it on a big table i need to figure what string actually causing this error so that i can check my function to see why its failing, any idea ?my sql statement SELECT [datavalue],[probname] FROM [dbo].[episode] CROSS APPLY [dbo].[Util_SplitString2Table]([probname],' ') WHERE ([status] IS NULL OR [status] = 0) AND ([probname] IS NOT NULL AND [probname] != '')Cheers |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2009-12-10 : 21:30:20
|
| figured out finally if any one else wants to know. the loop gave me exactly what row throwing the error..DECLARE c1 CURSOR FAST_FORWARDFOR SELECT DISTINCT [probname] FROM [episode] WHERE ([episode].[status] IS NULL OR [episode].[status] = 0) AND ([probname] IS NOT NULL AND [probname] != '')OPEN c1DECLARE @v VARCHAR(max)FETCH NEXT FROM c1 INTO @vWHILE @@FETCH_STATUS = 0BEGIN PRINT @v SELECT [datavalue] FROM [dbo].[Util_SplitString2Table](@v,' ') FETCH NEXT FROM c1 INTO @v END CLOSE c1DEALLOCATE c1 Cheers |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2009-12-13 : 14:47:34
|
| i was not after the user name but the particular string thats causing the issue. which i found and fixed it.Cheers |
 |
|
|
|
|
|