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
 LIKE to check for only one dot?

Author  Topic 

arya6000
Starting Member

3 Posts

Posted - 2011-01-04 : 21:17:02
Hello

Is it possible to create a LIKE clause that checks if a domain has one dot and not two dots(subdomain)?

Regards!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-01-04 : 21:42:52
WHERE url LIKE '%.%' AND url NOT LIKE '%.%.%'
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-01-04 : 21:45:17
or you could try an ETL Solution instead of a scan



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-01-04 : 22:42:09
...or so I heard....

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-01-04 : 23:05:53
Really Brett, keep it on topic, don't hijack other threads because you disagree with someone.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-01-04 : 23:51:18
So...you're saying that's not correct?

SELECT *
WHERE COL <> REPLACE(Col,'.','')

?????






Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-01-05 : 03:50:54
quote:
Originally posted by X002548

So...you're saying that's not correct?

SELECT *
WHERE COL <> REPLACE(Col,'.','')

?????






Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/





Yes this is not correct. It gives values that have atleat a dot and not neccessarily a single dot



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-01-05 : 04:01:27
Handy if you need to know HOW MANY dots - rather than just "no more than one"

LEN(COL) - LEN(REPLACE(Col,'.',''))
Go to Top of Page

MageshkumarM
Yak Posting Veteran

61 Posts

Posted - 2011-01-05 : 08:14:00
quote:
Originally posted by Kristen

Handy if you need to know HOW MANY dots - rather than just "no more than one"

LEN(COL) - LEN(REPLACE(Col,'.',''))




Hey i guess this will work...!

MAG,
Start with the new Idea..:)
Go to Top of Page
   

- Advertisement -