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 2005 Forums
 Transact-SQL (2005)
 where domain = 'http://' & domain

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2008-12-17 : 09:22:16
Hi,

I have a table, in which I am having domains passed in the format

"http://www.google.com"

but in the database they are stored purely in the format "www.google.com"


obviously I am not going to get the matches I want like this, so I think I have 2 options


WHERE domain = 'http://' + @referDomain

OR


@referDomain = REPLACE(@referDomain, 'http://', '')
WHERE domain = @referDomain

I am thinking the 2nd option is probably better for index reasons perhaps ?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-12-17 : 09:38:30
this is enough:
WHERE domain = REPLACE(@referDomain, 'http://', '')

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-17 : 10:34:10
WHERE domain LIKE '%' + @referDomain



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -