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)
 Help for string building

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-03-04 : 11:58:39
I used code bellow to make multiple where sentence (like: where ... and ... and...), it works fine. How to add strTable(variable) into front of columns?

from:
varMyWhere = varMyWhere & (" and OrderBy = '" & strOrderby & "'")

become:
varMyWhere = varMyWhere & (" and strTable.OrderBy = '" & strOrderby & "'")

Here, varMyWhere and strOrderBy are variables, OrderBy is column's name

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-04 : 13:05:44
varMyWhere = varMyWhere & "( and " & strTable & "." & OrderBy = '" & strOrderby & "')"

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-03-04 : 15:26:35
Thank you.
I tried it but did not work due to " is not match in left and right.
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-03-04 : 15:32:37
I got it:

varMyWhere = varMyWhere & "( and " & strTable & "." & " OrderBy = '" & strOrderby & "')"

Thank you!!!
Go to Top of Page
   

- Advertisement -