• j2cagle (5/10/2013)


    By "lost" I mean...the code is out there running, and we have versions of the source code in multiple locations. These multiple locations don't appear to be the version that is out there running. So, I was attempting to catch and correct the issue in the called SQL.

    Just to reiterate...

    I'm just looking for a way, that when passed "ABC DEF GHI", I could handle it in SQL to simply look only at the value up to the first space.

    If that can't be done, that's fine...I was just doing some investigation...

    How is it being passed currently. How is that data getting into the VB program? Is it a text box in an interface or from a file or from another database. This is important if you want to do this without changing code in VB.

    Once you get it in there, you'll want to use SUBSTRING(@TheVariable, 1, CHARINDEX(' ', @TheVariable) - 1)

    The error you're getting is because when the ABC DEF GHI gets to your stored proc, there's no single quotes around it, so DEF is considered the beginning of another statement.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams