Professional Web Applications Themes

Invalid character value for cast specification - Microsoft SQL / MS SQL Server

The below code gives me this error. However, the syntax checks out OK in Enterprise Manager. Can anyone enlighten me as to what this error means? thanks! ----------------------------------------------- Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver] Invalid character value for cast specification ----------------------------------------------- CREATE PROCEDURE sp_NRDates DATTE datetime, Column varchar(50) AS SELECT ItemStock.Manuf, ItemStock.OrderNo, ItemStock.Description, ItemStock.Category, Pricing.Price, ItemStock.d_Date FROM ItemStock INNER JOIN Pricing ON ItemStock.Label = Pricing.Label WHERE (ItemStock.NewRelease = 'Yes') AND (ItemStock.Status = 'av') AND (ItemStock.SoftHard = 'Soft') AND (ItemStock.d_Date = CONVERT(DATETIME, DATTE, 102)) ORDER BY CASE Column WHEN 'manuf_asc' THEN ItemStock.Manuf END ASC, ...

  1. #1

    Default Invalid character value for cast specification

    The below code gives me this error.
    However, the syntax checks out OK in Enterprise Manager.
    Can anyone enlighten me as to what this error means?
    thanks!
    -----------------------------------------------
    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    [Microsoft][ODBC SQL Server Driver]
    Invalid character value for cast specification
    -----------------------------------------------
    CREATE PROCEDURE sp_NRDates
    DATTE datetime, Column varchar(50)

    AS

    SELECT ItemStock.Manuf, ItemStock.OrderNo, ItemStock.Description,
    ItemStock.Category, Pricing.Price, ItemStock.d_Date
    FROM ItemStock INNER JOIN Pricing ON ItemStock.Label =
    Pricing.Label
    WHERE (ItemStock.NewRelease = 'Yes') AND (ItemStock.Status = 'av') AND
    (ItemStock.SoftHard = 'Soft') AND (ItemStock.d_Date = CONVERT(DATETIME,
    DATTE, 102))

    ORDER BY
    CASE Column WHEN 'manuf_asc' THEN ItemStock.Manuf END ASC,
    CASE Column WHEN 'orderno_asc' THEN ItemStock.OrderNo END ASC,
    CASE Column WHEN 'description_asc' THEN ItemStock.Description END ASC,
    CASE Column WHEN 'category_asc' THEN ItemStock.Category END ASC,
    CASE Column WHEN 'price_asc' THEN Pricing.Price END ASC,
    CASE Column WHEN 'manuf_desc' THEN ItemStock.Manuf END DESC,
    CASE Column WHEN 'orderno_desc' THEN ItemStock.OrderNo END DESC,
    CASE Column WHEN 'description_desc' THEN ItemStock.Description END DESC,
    CASE Column WHEN 'category_desc' THEN ItemStock.Category END DESC,
    CASE Column WHEN 'price_desc' THEN Pricing.Price END DESC
    GO


    shank Guest

  2. #2

    Default Re: Invalid character value for cast specification

    Since you already declare DATTE there is no need for convert() function.

    CREATE PROCEDURE sp_NRDates
    DATTE datetime, Column varchar(50)

    AS

    SELECT ItemStock.Manuf, ItemStock.OrderNo, ItemStock.Description,
    ItemStock.Category, Pricing.Price, ItemStock.d_Date
    FROM ItemStock INNER JOIN Pricing ON ItemStock.Label =
    Pricing.Label
    WHERE (ItemStock.NewRelease = 'Yes') AND (ItemStock.Status = 'av') AND
    (ItemStock.SoftHard = 'Soft') AND (ItemStock.d_Date = DATTE)

    ORDER BY
    CASE Column WHEN 'manuf_asc' THEN ItemStock.Manuf END ASC,
    CASE Column WHEN 'orderno_asc' THEN ItemStock.OrderNo END ASC,
    CASE Column WHEN 'description_asc' THEN ItemStock.Description END ASC,
    CASE Column WHEN 'category_asc' THEN ItemStock.Category END ASC,
    CASE Column WHEN 'price_asc' THEN Pricing.Price END ASC,
    CASE Column WHEN 'manuf_desc' THEN ItemStock.Manuf END DESC,
    CASE Column WHEN 'orderno_desc' THEN ItemStock.OrderNo END DESC,
    CASE Column WHEN 'description_desc' THEN ItemStock.Description END DESC,
    CASE Column WHEN 'category_desc' THEN ItemStock.Category END DESC,
    CASE Column WHEN 'price_desc' THEN Pricing.Price END DESC
    GO


    --
    -oj
    RAC v2.2 & QALite!
    [url]http://www.rac4sql.net[/url]



    "shank" <shanktampabay.rr.com> wrote in message
    news:ur9ldjcQDHA.3020TK2MSFTNGP10.phx.gbl...
    > The below code gives me this error.
    > However, the syntax checks out OK in Enterprise Manager.
    > Can anyone enlighten me as to what this error means?
    > thanks!
    > -----------------------------------------------
    > Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    > [Microsoft][ODBC SQL Server Driver]
    > Invalid character value for cast specification
    > -----------------------------------------------
    > CREATE PROCEDURE sp_NRDates
    > DATTE datetime, Column varchar(50)
    >
    > AS
    >
    > SELECT ItemStock.Manuf, ItemStock.OrderNo, ItemStock.Description,
    > ItemStock.Category, Pricing.Price, ItemStock.d_Date
    > FROM ItemStock INNER JOIN Pricing ON ItemStock.Label =
    > Pricing.Label
    > WHERE (ItemStock.NewRelease = 'Yes') AND (ItemStock.Status = 'av') AND
    > (ItemStock.SoftHard = 'Soft') AND (ItemStock.d_Date = CONVERT(DATETIME,
    > DATTE, 102))
    >
    > ORDER BY
    > CASE Column WHEN 'manuf_asc' THEN ItemStock.Manuf END ASC,
    > CASE Column WHEN 'orderno_asc' THEN ItemStock.OrderNo END ASC,
    > CASE Column WHEN 'description_asc' THEN ItemStock.Description END ASC,
    > CASE Column WHEN 'category_asc' THEN ItemStock.Category END ASC,
    > CASE Column WHEN 'price_asc' THEN Pricing.Price END ASC,
    > CASE Column WHEN 'manuf_desc' THEN ItemStock.Manuf END DESC,
    > CASE Column WHEN 'orderno_desc' THEN ItemStock.OrderNo END DESC,
    > CASE Column WHEN 'description_desc' THEN ItemStock.Description END DESC,
    > CASE Column WHEN 'category_desc' THEN ItemStock.Category END DESC,
    > CASE Column WHEN 'price_desc' THEN Pricing.Price END DESC
    > GO
    >
    >

    oj Guest

Similar Threads

  1. Getting invalid character in Wordproc
    By palaksha@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: September 9th, 07:27 AM
  2. Invalid Authorization Specification
    By Mrtechguy in forum Coldfusion Server Administration
    Replies: 1
    Last Post: July 10th, 04:52 PM
  3. Invalid character instead of Line break??
    By JB in forum Macromedia Director Basics
    Replies: 1
    Last Post: December 6th, 09:31 AM
  4. MapPath invalid character error
    By Supertzar in forum ASP
    Replies: 4
    Last Post: September 29th, 09:38 PM
  5. invalid cast exception with XmlSerializer
    By jc in forum ASP.NET Web Services
    Replies: 0
    Last Post: September 15th, 10:54 AM

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