Advanced T-SQL

  • Hmm,not getting correct results.

  • That was pretty vague. Maybe you need to answer ThomasH's questions before going any further. I assumed you could convert to varchar. Maybe not? Is this stuff already stored as text? Or are you importing this? If you are importing from a text file, you might handle this with the File System Object, manipulating the TextStream in VBscript?

    Jules

    [font="Courier New"]ZenDada[/font]

  • ThomasH,

    1. What is the Max(DataLength()) you would be dealing with?

    8000

    2. Is the data CR/LF delimited, or other delimiter?

    not delimited, Stored in database as text field

    3. Is there any guarantee that the ending 8000 characters of the data will have what you are looking for?

    no guarantee

    TnJMoseley,

    That was pretty vague. Maybe you need to answer ThomasH's questions before going any further. I assumed you could convert to varchar. Maybe not? Is this stuff already stored as text? Or are you importing this? If you are importing from a text file, you might handle this with the File System Object, manipulating the TextStream in VBscript?

    Ans: It is stored as text filed in database, and i converted to VARCHAR when read from db.

  • Okay, let's try this:

    1 - Test the length of the text field and compare it to the varchar length. Are you getting all of it? I have no experience with text data type in SQL Server. Do you lose the unprintables when you cast?

    2 - Your first example had no CRLF's, but the second one did. Are you looking for that (those) characters, or something else?

    3 - In your example, can you highlight or bold the exact character whose position you want to find? Or next to it if unprintable character is what you seek.

    Thanks!

    Jules

    [font="Courier New"]ZenDada[/font]

  • Hi,

    The data length would be 4000, need find last occurance of (2)Total line,(3) Total line,(4) Total line (5) Total line (6) Total line (7) Total line.

    I did in loop from reverse worked fine, Thnaks for all your efforts.

  • I completely misunderstood what you wanted - I thought you were looking for a single character from the entire field!

    Well, congratulations on your success! Half the fun of this forum is just trying to solve problems, if we don't get the answer you were looking for. Thanks for the great puzzle.

    Jules

    [font="Courier New"]ZenDada[/font]

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply