lapucca
asked on
Why this TSQL syntax error?
Hi, I'm using sql 2005 express. The sub select query runs fine when I run it by itself. But I got the following error when I embedded it in this Insert error? Thanks.
INSERT INTO [MedDb].[dbo].[DegreeMajor ]
([Major Title])
VALUES
(select distinct degree_Major from dbo.PersonDegree pd
where degree_Major is not null and degree_Major <> '.' and degree_Major <> '')
Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near ')'.
INSERT INTO [MedDb].[dbo].[DegreeMajor
([Major Title])
VALUES
(select distinct degree_Major from dbo.PersonDegree pd
where degree_Major is not null and degree_Major <> '.' and degree_Major <> '')
Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near ')'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
http://www.devguru.com/technologies/t-sql/7124.asp