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 |
|
abundant_lyfe
Starting Member
10 Posts |
Posted - 2007-02-20 : 10:47:53
|
Um, still trying to transpose MySQL into T-SQL. Inserting info into a table, where one of the columns meets a certain criteria.insert into employee (/*emp_id,*/ fname, lname, start_date, dept_id, title, assigned_branch_id)values (/*null,*/ 'Michael', 'Smith', '2001-06-22', (select dept_id from department where name = 'Administration'), 'President', (select branch_id from branch where name = 'Headquarters'));But I'm getting this error :Msg 1046, Level 15, State 1, Line 5Subqueries are not allowed in this context. Only scalar expressions are allowed.Any help would be greatly appreciated. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-02-20 : 11:01:05
|
| insert into employee (/*emp_id,*/ fname, lname, start_date, dept_id, title, assigned_branch_id)select /*null,*/ 'Michael', 'Smith', '2001-06-22', d.dept_id, b.branch_idfrom department dcross join branch bwhere d.name = 'Administration' and b.name = 'Headquarters'- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
abundant_lyfe
Starting Member
10 Posts |
Posted - 2007-02-20 : 11:03:44
|
| Thank you Jeff. Hope I don't end up in the Twit List for this. :) |
 |
|
|
|
|
|
|
|