Results 1 to 3 of 3

Thread: updating a text column

  1. #1
    lisa Guest

    updating a text column


    how can i update a column with datatype of text with a combination of columns having a datatype of float? do i convert the float columns to varchar/char/?? and/or can i convert the column i am updating?

    thanks!

  2. #2
    Thomas R. Hummel Guest

    updating a text column (reply)

    You cannot convert the column that you are updating (I'm not sure what you were getting at with that...), but you can convert the source columns (or variables) with either the CONVERT or CAST functions. Check your online help for the specifics of these functions, but it would basically be something like:

    update MyTable
    set MyString = convert(varchar(20), @MyInteger)
    where ...

    or

    update MyTable
    set MyString = cast(@MyInteger as varchar)
    where ...

    You can include the length in the cast statement as well if you prefer.


    ------------
    lisa at 9/20/01 3:11:33 PM


    how can i update a column with datatype of text with a combination of columns having a datatype of float? do i convert the float columns to varchar/char/?? and/or can i convert the column i am updating?

    thanks!

  3. #3
    Bob Guest

    updating a text column (reply)

    Can't convert float to text or text to float. Try converting the float data to char/varchar, then to text?


    ------------
    lisa at 9/20/01 3:11:33 PM


    how can i update a column with datatype of text with a combination of columns having a datatype of float? do i convert the float columns to varchar/char/?? and/or can i convert the column i am updating?

    thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •