Stored Procedure Question

  • This may be a couple of newbie questions but here goes. Is there some rule that does not allow the datatype Text to be use as a variable datatype in a stored procedure? I can declare my variable as a larger varchar but not as a Text. And if the data I am receiving is coming from a Text field can a large varchar receive it without a type mismatch problem?

    Any help would be appreciated.

  • >> there some rule that does not allow the datatype Text to be use as a variable datatype in a stored procedure?

    Yes.

    I can declare my variable as a larger varchar but not as a Text. And if the data I am receiving is coming from a Text field can a large varchar receive it without a type mismatch problem?

    Yes.

    Cursors never.

    DTS - only when needed and never to control.


    Cursors never.
    DTS - only when needed and never to control.

  • First you can use Text datatypes for SP as input or output variables. Don't ask how works as output variable as I have seen no workable way.

    Other than that text cannot be used as a variable object.

  • Antares,

    I've used it as an output variable when all I wanted to do was return a single picture (Binary field instead of text but works the same way). Once you have done this then if you are using ADO you have to use the GetChunk method to get each chunk of the text/binary field. Pretty nasty code to deal with but it worked.

    Gary Johnson

    DBA

    Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

  • Could you post a snippet of what you did because you cannot set a text variable within an SP every way I tried and have seen no working method otherwise. I would be interested.

  • Like Gary said it is not nice, but here ya go : http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B180368 I have done this before, and IMHO that when I am storing this much text in SQL Server, it is more efficient to actually store a file pointer rather than all the text. It just becomes to expensive at a certain point. I usually have the file pointer point at a web server so that I can retrieve the text via HTTP.

    Tim C.

    //Will write code for food


    Tim C //Will code for food

Viewing 6 posts - 1 through 5 (of 5 total)

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