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 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-10-03 : 10:35:53
|
In this thread, I was stumped with a numeric conversion error.The query causing the error was discussed in another thread. The query itself appears below-- Process the AssignmentsINSERT INTO dbo.Assignments (UserID, CourseID) SELECT UC.UserID, UC.CourseID FROM ( SELECT U2.UserID, -- Rowset of UserID and CourseID from UserImport CSV string 'Assignments' CAST(SUBSTRING(' ' + Assignments + ' ', ID, CHARINDEX(' ', ' ' + Assignments + ' ', ID)-ID) AS INT) AS CourseID FROM dbo.UsersImport UI CROSS JOIN dbo.Tally INNER JOIN (SELECT UserID, Username FROM dbo.Users WHERE ClientID = @ClientID) U2 ON U2.Username = UI.Username WHERE ID BETWEEN 2 AND Len(' ' + Assignments + ' ') -- Limit the rows used in the Tally table AND SUBSTRING( ' ' + Assignments + ' ' , ID - 1, 1) = ' ' AND ISNUMERIC(SUBSTRING(' ' + Assignments + ' ', ID, CHARINDEX(' ', ' ' + Assignments + ' ', ID)-ID)) = 1 -- Ensure this is a valid integer ) UC LEFT OUTER JOIN dbo.Assignments AI ON AI.UserID = UC.UserID AND AI.CourseID = UC.CourseID WHERE AI.UserID IS NULL(PS: Anyone know how to make the code font larger?)While debugging the numeric conversion error, I had eliminated all the conversions of CourseID to INT and it was still pulling the conversion error.I found it, but it took time because I was *looking for bugs in all the wrong places* (sorry).Sam |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-10-03 : 11:40:02
|
Reminds me of a song..quote: Keep on looking nowYou gotta keep on looking nowKeep on looking nowYou're looking for bugsIn all the wrong placesWhere your walk it's always shadowConversation always shallowWhen they talk they never look you in the eyeThey look over your shoulderTo faces even colderAnd you feel a little olderEvery timeYou're looking for [bugs]In all the wrong placesWhen you're looking for reactionWhen you're searching for directionWhen you're scared of rejectionOr attackYou need the warmth of bugingWhen you're growing tired of seeingA colourless reflectionLooking backYou're looking for bugsIn all the wrong placesSomething real to fill those little empty spacesSo you're looking for bugs in all the wrong placesYou need understandingYou need a homeAll those people so aloneYou need understandingYou need a homeAll those people so aloneYou're looking for bugsIn all the wrong placesYou're looking for bugsIn all the wrong placesYou better keep on looking now!And so the evening shade will fallWhere nameless voices call and callAnd think of all the friends you madeWhile you toast with Prozac and lemonadeYou can hold me under septic skies(You can dream to your own places)Watch the sun set in my eyes(You can't seem to put)Could this be the time to die?(A name to all the faces)The wind upon your face(Something real)So you're looking for bugs in all the wrong placesYou keep on looking for bugs in all the wrong placesDream and take away the tears(Keep on looking now)Drift on to where your heart is numb(You gotta keep on looking now)It's bugly there where bugs becomesA drug to fill your needJust believe in you!And learn to bug yourselfBefore anyone else
Brett8-)SELECT @@POST FROM Brain ORDER BY NewId()That's correct! It's an AlphaNumeric! |
 |
|
|
|
|
|
|
|