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.
| Author |
Topic |
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-07-01 : 10:44:03
|
| I have two tables called CountyCodes and AddressDBCountyCodesStCode char(2)CountyCd char (3)CountyName varchar(50)StNameAbr Char(2)StNameLong varchar(30)AddressDBZip char(5)Doc char(3)Scc char(5)I want to join the two tables but they didn't have a field in common so to do so I did this:SELECT CONCAT(StCode, CountyCd) AS SSCFROM dbo.CountyCodesNow how do I get this query to work?SELECT { fn CONCAT(c.StCode, c.CountyCd) } AS c.Scc, c.CountyName, c.StNameAbr, c.StNameLongFROM dbo.CountyCodes AS c INNER JOIN dbo.AddressDB AS d ON c.scc = d.SccWHERE (d.Doc = '275')This query is giving me this error:CONCAT is not a recognized built-in function name I'm using SQL 2005 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-01 : 10:47:11
|
| SELECT c.StCode,+','+ c.CountyCd AS c.Scc, c.CountyName, c.StNameAbr, c.StNameLongFROM dbo.CountyCodes AS c INNER JOINdbo.AddressDB AS d ON c.scc = d.SccWHERE (d.Doc = '275')MadhivananFailing to plan is Planning to fail |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-07-01 : 10:48:35
|
| [code]SELECT a.StCode + a.CountyCd as SSC,...FROM CountyCodes aINNER JOIN AddressDB b on b.Scc = a.StCode + a.CountyCd[/code] |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-01 : 10:48:55
|
SELECT c.StCode + c.CountyCd AS Scc, c.CountyName, c.StNameAbr, c.StNameLongFROM dbo.CountyCodes AS c INNER JOINdbo.AddressDB AS d ON c.StCode + c.CountyCd = d.SccWHERE (d.Doc = '275') No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-01 : 10:49:45
|
 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-07-01 : 10:52:03
|
| Thanks so much you guys crack me up. I love it how you race! They all work! |
 |
|
|
|
|
|
|
|