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.
| Author |
Topic |
|
pfdtv
Starting Member
10 Posts |
Posted - 2008-08-07 : 15:10:01
|
| Hi,I am using MS SQL Server 2005 express.I have a script that searches tables for a query term. Right now I am just using "search query" in a couple instances of the code. Is there a way to create something like a variable or like the C++ define directive so thatThanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
pfdtv
Starting Member
10 Posts |
Posted - 2008-08-07 : 15:43:41
|
| Sure..SELECT * FROM[...]INNER JOIN FREETEXTTABLE(t1,*,'search term') [...]INNER JOIN FREETEXTTABLE(t2,(summary,description), 'search term' ) [...]So basically I am wondering if there is a way to only have 'search term' appear once (so it can be easily changed for all instances). For example, in C++ you can create a constant for the string and use the variable name instead of the actual string, so that the actual string only appears once at the top. Or you could do the same with the #define directive. |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-08-07 : 15:55:22
|
| DECLARE @searchterm varchar(50)SET @searchterm = 'searchterm'SELECT * FROM[...]INNER JOIN FREETEXTTABLE(t1,*,@searchterm) [...]INNER JOIN FREETEXTTABLE(t2,(summary,description), @searchterm ) [...] |
 |
|
|
|
|
|
|
|