Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Wild Join Question Expand / Collapse
Author
Message
Posted Wednesday, December 23, 2009 10:14 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, June 8, 2012 12:30 AM
Points: 150, Visits: 3,892
Comments posted to this topic are about the item Wild Join Question
Post #838852
Posted Thursday, December 24, 2009 5:10 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:07 AM
Points: 6,040, Visits: 8,322
Carleton (12/23/2009)
If you are unsure if the field contains a wildcard character when joining using the LIKE operator, you can avoid false positive results by observing this tip:

But what is the point of using LIKE if you do this? Why not simply use the = operator?



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #838944
Posted Thursday, December 24, 2009 5:57 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 7:30 AM
Points: 1,339, Visits: 1,714
Hugo Kornelis (12/24/2009)
Carleton (12/23/2009)
If you are unsure if the field contains a wildcard character when joining using the LIKE operator, you can avoid false positive results by observing this tip:

But what is the point of using LIKE if you do this? Why not simply use the = operator?


In general, you probably wouldn't use LIKE exactly like that, but with your own wildcards attached. For example, you may want to see if a string contains another string in its entirety. If the second string might have a wildcard in it, you'd have to do something like:

select * from #table1 t1 
inner join #table2 t2
on t1.Col1 like
'%' + REPLACE(REPLACE(t2.Col1,'%','[%]'),'_','[_]') + '%'


Otherwise, the wildcard in the second string may cause false positives.
Post #838949
Posted Wednesday, December 30, 2009 8:06 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 9, 2010 11:48 AM
Points: 27, Visits: 52
The complete answer should be “It depends”. If you have a case sensitive collation designator you will get:
Msg 208, Level 16, State 0, Line 3
Invalid object name '#table1'.
Since the script created a table #Table1 and tries to reference #table1
Post #840341
Posted Wednesday, January 6, 2010 3:21 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 13, 2014 7:12 AM
Points: 1,079, Visits: 592
Chris Carter-210078 (12/30/2009)
The complete answer should be “It depends”. If you have a case sensitive collation designator you will get:
Msg 208, Level 16, State 0, Line 3
Invalid object name '#table1'.
Since the script created a table #Table1 and tries to reference #table1
You're correct but based on what's given then you'll need to set collation to something that will provide with results for this scenario.


What you don't know won't hurt you but what you know will make you plan to know better
Post #842639
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse