Previous Thread:   Maximum Size for UDT

1/21/2006 10:38:28 PM    Re: Controling tha Parse method
Leila,  
  
I didn't give it a try, but I'd suggest you try forcing a call  
  
to Parse when s is null  
  
<SqlMethod(OnNullCall:=True)> Public Shared Function Parse(ByVal s As  
  
SqlString) As Point  
  
Steve Kass  
  
Drew University  
  
Leila wrote:



1/22/2006 2:53:16 AM    Controling tha Parse method
Hi,  
  
I want Parse method in my UDT (point) return a point like "0:0" if the user  
  
passed NULL into INSERT statement. Here is my Parse methods:  
  
-----------  
  
Public Shared Function Parse(ByVal s As SqlString) As Point  
  
If s.IsNull Then  
  
Dim u2 As Point = New Point  
  
u2.X = 0  
  
u2.Y = 0  
  
Return u2  
  
End If  
  
Dim u As Point = New Point  
  
u.X = Left(s, 1)  
  
u.Y = Right(s, 1)  
  
Return u  
  
End Function  
  
-----------  
  
But my query from the table returns null for values like:  
  
INSERT MyTab(Col2) VALUES(NULL)  
  
I expected to get "0:0" after inserting NULL value.  
  
How can I achieve it?  
  
Thanks in advance,  
  
Leila