Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQl server problem

Author  Topic 

kunaaldesai
Starting Member

36 Posts

Posted - 2009-08-15 : 19:09:34
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??

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-16 : 14:00:37
The error message is pretty self explanatory. What is the data type of the return vaue?
Go to Top of Page

kunaaldesai
Starting Member

36 Posts

Posted - 2009-08-16 : 14:03:47
it is navchar and I am expecting a sqlstring from VB.NET

Anything
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-16 : 15:59:07
2 bytes would mean NVARCHAR(1). You're getting 48 bytes returned. What is the length of your NVARCHAR?
Go to Top of Page

kunaaldesai
Starting Member

36 Posts

Posted - 2009-08-16 : 16:05:15
Oh so I have to make it nvarchar(24) at least to capture it. I got it thank you very much

Anything
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-16 : 18:09:16
Great! You're welcome.
Go to Top of Page
   

- Advertisement -