May 9, 2008 at 2:13 pm
Hello all,
I am trying to create a temp table and insert with dupes from two other tables.
But, I have not got passed the parse. I receive the following syntax error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.
Here is the sql:
Create Table #Play (
field1 as char(12),
field2 as char(8),
date as datetime,
field3 as char(12)
)
GO
Insert INTO #Play (field1, field2, date, field3)
SELECT T1.field1,
T1.field2,
T1.date,T2.field3
FROM
Table1 T1
left outer join Table2 T2
on T1.alias = T2.alias
WHERE
field1 IN (SELECT DISTINCT field1
FROMTable1
GROUP BY field1
HAVING COUNT(field1) > 1)
select * from #Play
Any help is most appreciated!
Thanks,
DK
May 9, 2008 at 3:01 pm
You need to get rid of the "AS" in your create table statement
Create Table #Play(
field1 char(12),
field2 char(8),
date datetime,
field3 char(12)
)
There may be other errors, but that should get your headed in the right direction.
Kyle
May 10, 2008 at 9:17 am
Thanks Kyle, that worked.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply