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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic SQL Statements in Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-24 : 09:33:58
Praveen writes "Hello Sql Team,
I am writing a stored procedure in which i want to generate a dyanamic query, basically i want to write a search query, in which i am passing a string into the stored procedure and the string is stripped into number on words. Based upon the number of words my sql query should be excuted..

For example

WsArr = Split(WsSearchString, " ")

WS_SQL = " SELECT col1 FROM SearchTable WHERE SEARCH LIKE '%" & WsSearchString & "%'"

If UBound(WsArr) > 0 Then
For WS_INDEX = 0 To UBound(WsArr)
WS_SQL = WS_SQL & " OR SEARCH LIKE '" & WsArr (WS_INDEX) & "%' OR SEARCH LIKE '%" & WsArr(WS_INDEX) & "%'"
Next
End If

Ws_TmpSet.Open WS_SQL, WS_CONN, adOpenForwardOnly, adLockOptimistic, adCmdText



can i convert the about code into stored procedure...

Praveen B"
   

- Advertisement -