Professional Web Applications Themes

error: String or binary data would be truncated. - Microsoft SQL / MS SQL Server

I'm trying to fix the fax numbers in our contact table to have a "1-" in front of the number from: 800-555-1212 to: 1-800-555-1212 Here's the code I'm trying to exit in the SQL Query yzer: update contact set businessfax = '1-' + businessfax where left(businessfax,1) <> '1' and len(ltrim(rtrim(businessfax))) >= 10 and len(ltrim(rtrim(businessaddresscountry))) = 0 But it won't execute. I'm getting the following error message: Server: Msg 8152, Level 16, State 9, Line 1 String or binary data would be truncated. The statement has been terminated. Any suggestions or help would be appreciated. Thanks, Scott...

  1. #1

    Default error: String or binary data would be truncated.

    I'm trying to fix the fax numbers in our contact table to have a "1-" in
    front of the number

    from:
    800-555-1212

    to:
    1-800-555-1212

    Here's the code I'm trying to exit in the SQL Query yzer:

    update contact
    set businessfax = '1-' + businessfax
    where left(businessfax,1) <> '1'
    and len(ltrim(rtrim(businessfax))) >= 10
    and len(ltrim(rtrim(businessaddresscountry))) = 0

    But it won't execute. I'm getting the following error message:

    Server: Msg 8152, Level 16, State 9, Line 1
    String or binary data would be truncated.
    The statement has been terminated.


    Any suggestions or help would be appreciated.

    Thanks,

    Scott


    Scott A. Keen Guest

  2. #2

    Default error: String or binary data would be truncated.

    Check the length on the column businessfax and make sure
    that it is large enough to accomodate the addition of
    the '1-'. I duplicated your error with a column length
    of char(12). When I increased it to char(14), it updated
    with no problem.

    Lori
    >-----Original Message-----
    >I'm trying to fix the fax numbers in our contact table
    to have a "1-" in
    >front of the number
    >
    >from:
    >800-555-1212
    >
    >to:
    >1-800-555-1212
    >
    >Here's the code I'm trying to exit in the SQL Query
    yzer:
    >
    >update contact
    >set businessfax = '1-' + businessfax
    >where left(businessfax,1) <> '1'
    >and len(ltrim(rtrim(businessfax))) >= 10
    >and len(ltrim(rtrim(businessaddresscountry))) = 0
    >
    >But it won't execute. I'm getting the following error
    message:
    >
    >Server: Msg 8152, Level 16, State 9, Line 1
    >String or binary data would be truncated.
    >The statement has been terminated.
    >
    >
    >Any suggestions or help would be appreciated.
    >
    >Thanks,
    >
    >Scott
    >
    >
    >.
    >
    LoriL Guest

Similar Threads

  1. String truncated at the first space in the string
    By Serge Myrand in forum ASP Database
    Replies: 5
    Last Post: July 6th, 10:42 AM
  2. String or binary data would be truncated error
    By Ivan Demkovitch in forum ASP
    Replies: 3
    Last Post: September 18th, 10:39 PM
  3. #24777 [NEW]: $_GET values truncated at %3C in query string
    By csnyder at chxo dot com in forum PHP Development
    Replies: 0
    Last Post: July 23rd, 08:59 PM
  4. Replies: 0
    Last Post: July 21st, 08:44 AM
  5. Replies: 0
    Last Post: July 10th, 04:26 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139