Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Posts
    20

    Unanswered: SQl server problem

    Hey guys,
    I am using a userdefined assembly funciton which is basically defined in VB.net and calling it from SQL Server 2008. Now, when it did call it then SQL server gives me error.

    My code is as following:

    select dbo.geocode('2650, college place','Fullerton','CA','92831','USA')

    Where geocode is the function, originally defined in VB>net which convert any address into its longitude and lattitude. So basically when I am writting the query mentioned above then I am expecting the out put to be some thing like this (33.994278,-117.887951) where the values are Longotude and Lattitude of that address respectively.

    And I am getting follwoing error:

    Trying to convert return value or output parameter of size 48 bytes to a T-SQL type with a smaller size limit of 2 bytes.
    System.Data.SqlServer.TruncationException:

    I think there is come converison problem but how to deal with that??

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What is the return data type of the assembly?

    Does the code execute correctly outside of SQL Server?
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    We also need to know the return data type defined in T-SQL. I'm guessing you are returning a string from CLR and defining a small int in T-SQL.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Coo, good point P.

    Except ints are 4 bytes. tinyint is 2 bytes ;)
    George
    Home | Blog

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by gvee
    Except ints are 4 bytes. tinyint is 2 bytes
    Ints are 4 bytes, tinyints are 1 byte (0-255 ). Small int is 2 bytes.
    int, bigint, smallint, and tinyint (Transact-SQL)

    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    teehee, that typo makes us even
    George
    Home | Blog

Posting Permissions

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