ASP.NET学习社区

首页 » ASP.NET学习区 » 自由问答 » SQL语句能否包含子程序调用?
cngothic - 2008-4-9 8:30:00


Function GotTopic(Str,StrLen)
Dim l,t,c, i,LableStr,regEx,Match,Matches
If StrLen=0 then
GotTopic=""
exit function
End If
if IsNull(Str) then
GotTopic = ""
Exit Function
end if
if Str = "" then
GotTopic=""
Exit Function
end If
Str=Replace(Replace(Replace(Replace(Str," "," "),""",Chr(34)),">",">"),"<"," <")
l=len(str)
t=0
strlen=Clng(strLen)
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
GotTopic=left(str,i)
exit for
else
GotTopic=str
end if
Next
GotTopic = Replace(Replace(Replace(Replace(GotTopic," "," "),Chr(34),"""),">",">")," <","<")
End Function

Sql = "select * from tb where dbo.f_GotTopic(content,3)='123'"


这种不行.我想问的是SQL语句中可以包含自定义函数.这个自定义函数.只能写在存储过程里吗?
像上面的用VBSCRIPT写的不能用吗?
whgfu - 2008-4-9 8:33:00
是不可以的,只能在存储过程中
aspx1 - 2008-4-9 10:33:00
不太明白你的意思。
VBSCRIPT写的函数怎么用sql调用?不能吧。
mssql数据库中可以自定义函数,这个函数可以在sql语句或存储过程中调用。但用其他语言 vb,c#等写的函数,sql无法直接调用啊。access数据库中好象支持一些vb语法,不过详细内容 我也不太清楚。
whgfu - 2008-4-9 15:33:00
access支持vb语法其实还是vbscript写的宏。。。
1
查看完整版本: SQL语句能否包含子程序调用?