create function nn(@x datetime) returns TABLE
as
return (select @x as x )
VB调用
Private sqlcon As New ADODB.Connection
Private sqlres As New ADODB.Recordset
sqlcon.Provider = "SQLOLEDB.1"
sqlcon.Open "User ID = sa;Password=sad23456789;Initial Catalog=mm;Data Source=dd"
sqlcon.CursorLocation = adUseClient
sqlres.open "select * from nn('2012-11-11')",sqlcon,3,3
print sqlres.fields(0).value
sqlres.close
set sqlres=nothing
sqlcon.close
set sqlcon=nothing