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
 Insert Into

Author  Topic 

BSinatra
Starting Member

13 Posts

Posted - 2007-08-09 : 12:36:14
I'm guessing this will be easy...

this is what I need to do

select Columna from TABLEA where TABLEA.Columnb = x and TABLEA.Columnc = y

Then i need to INSERT that Columna data into another table along with user data at the same time.

this is what I tried and it fails:

SELECT PersonalID from PERSONS where PERSONS.BirthDate = '1960-01-01' AND PERSONS.Name LIKE 'xxx%'AND PERSONS.Email = 'xxx@yyy.com'
insert into PATWEB ("PersonalID", "PIN", "Question", "Answer") Values (PERSONS.PersonalID, '55555', 'What is your Car?', 'Dodge')

I know this looks pretty messy...I appreciate the help

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-08-09 : 12:39:47
[code]
INSERT INTO PATWEB (PersonalID, PIN, Question, Answer)
SELECT PersonalID, '55555', 'What is your Car?', 'Dodge'
FROM PERSONS
WHERE PERSONS.BirthDate = '1960-01-01'
AND PERSONS.Name LIKE 'xxx%'
AND PERSONS.Email = 'xxx@yyy.com'
[/code]


Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

BSinatra
Starting Member

13 Posts

Posted - 2007-08-09 : 12:45:14
Thanks, that is exactly what I was trying to do.
Go to Top of Page
   

- Advertisement -