PuOn,
In T-SQL for SQL Server 2000, you need to reference the column name
(Column_name) of the table (browser) in the WHERE clause where you have the
string "$http_user_agent", for example:
SELECT id FROM browser WHERE Column_name
as there is no direct equalivant T-SQL syntax fro "REGEXP", except for LIKE
and PATINDEX that used together or separtly should suit your needs.
Review SQL Server 2000 Books Online (BOL) titles "Pattern Matching in Search
Conditions" and "PATINDEX" as well as "Comparing CHARINDEX and PATINDEX"
--Patindex T-SQL example:
use Northwind
select Description from Northwind.dbo.Categories
where patindex('%[b,B]read%',description) > 0
and patindex('_[^e]%',description) = 1
/* -- returns:
Description
---------------------------------------
Breads, crackers, pasta, and cereal
(1 row(s) affected)
*/
Hope this helps,
Regards,
John
> i'm trying do this in sql:
> the mysql query:
> "SELECT id FROM browser WHERE '$http_user_agent' REGEXP browser_regexp"
>
> where $http_user_agent is a string i.e."mozilla/4.0 (compatible; msie 6.0; windows nt 5.0; .net clr 1.1.4322" and the browser_regexp is column in table
"browser" with values "msie.6","opera.6",..etc.
> the result should be an id where $http_user_agent contains any value from browser_regexp
>
> in mysql worked prefectly, now i'm trying to convert it to sql.
> LIKE don't work for me, but maybe i'm not using it correctly...
> please help, thanks