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
 string comparision in sql procedure

Author  Topic 

jess1984
Starting Member

14 Posts

Posted - 2010-06-23 : 00:37:37
I want to compare two strings from two table , if equal store that string in another table

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-23 : 00:41:39
What's your question?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-23 : 01:12:00
Show us the table structures and some sample data.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-06-23 : 02:07:25
[code]INSERT INTO myStringsAreAlikeTable
SELECT a.*
FROM myStringsTable1 a
INNER JOIN myStringsTable2 b
ON a.ID = b.ID
WHERE a.StringColumn1 = b.StringColumn2[/code]If this is not what you want then please add some more info.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-06-23 : 11:18:46
Beware that

WHERE a.StringColumn1 = b.StringColumn2

will be case INSENSITIVE unless you are using a Case Sensitive collation. So if you want Upper/Lower case letter to be treated as different then you need a bit more "glue".

Same thing if you want different accents etc. which collate the same to be treated as being different.
Go to Top of Page
   

- Advertisement -