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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to insert to table in one line when i insert it twice

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-27 : 08:59:03
annisha writes "i have one table
and i want to insert into table two times
one time in some of the colmns
and the second time in the rest of them

when i insert it does 2 lines in the table
how can i do that it will be in one line

i did this(insert into) in 2 times
because i wanted to check if a name was in the table before
i did a form
then i sent it to asp file
and there i checked if i have this name in my table
if i didnt i did insert to all the table
and if i didnt i did insert to all expet the name
and when they did a valid name at least
then i did insert just to the name
so i need it one line
and not in two
please help"

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-04-27 : 09:15:22
The first is an INSERT to populate the row with the information you have in the first operation. The second will be an UPDATE to the row you just inserted with the information updating the remaining columns.

Or if possible you could combine the two operations into one INSERT.
Go to Top of Page
   

- Advertisement -