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
 General SQL Server Forums
 New to SQL Server Programming
 Stored Procedure

Author  Topic 

suarezst1984
Starting Member

16 Posts

Posted - 2009-02-02 : 17:01:10
Could someone help me to understand what the following sql query is saying. This is basically a stored procedure but I need to understand what this says or is anyway to actually put this in a simpler query? term1 and term2 are basically the number of parameters for a search. If I search in a website for white paint (white would be param1 and paint would be param2).
Thanks for any help

--SET @searchString = 'SELECT sfProducts.prodID, sfProducts.prodName, sfProducts.prodImageSmallPath, sfProducts.prodLink, sfProducts.prodPrice, sfProducts.prodSaleIsActive, sfProducts.prodSalePrice, sfProducts.ProdID, sfProducts.prodDescription, sfProducts.prodAttrNum, sfProducts.prodCategoryId, sfProducts.prodShortDescription '
SELECT @searchString = @searchString + 'FROM CONTAINSTABLE(prodSearchTemp, *, ' + char(39) + 'FORMSOF(INFLECTIONAL, ' + @term1 + ', ' + @term2 + ')' + char(39) + ') S '
SELECT @searchString = @searchString + 'INNER JOIN sfProducts ON S.[KEY] = sfProducts.prodID INNER JOIN prodSearchTemp ON S.[KEY] = prodSearchTemp.prodID '
SELECT @searchString = @searchString + 'LEFT JOIN sfcompatString ON sfProducts.prodID = sfCompatString.compatStringProdID '
SELECT @searchString = @searchString + 'INNER JOIN sfManufacturers ON sfProducts.prodManufacturerID = sfManufacturers.mfgID '
SELECT @searchString = @searchString + 'WHERE (FREETEXT(prodSearchTemp.*, ' + char(39) + @term1 + char(39) + ') '
SELECT @searchString = @searchString + @andOr + ' FREETEXT(prodSearchTemp.*, ' + char(39) + @term2 + char(39) + ')) '

END
   

- Advertisement -