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)
 Insert using both Values and Select at the same time

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-20 : 09:32:29
Tan writes "I have a table consisting of 5 columns mainly:
ID,Last Name,First Name, Occupation & Age.

The first column holds the unique ID (primary key which is a running number). Using the new XML feature present in SQL server 2000 I am able to provide the data for column 2 and after using the XML string below...

-----------------------------------------------------------
<Customers Last Name="Kim"
FirstName="Henry"
Occupation = "Driver"
Age="35" >
-----------------------------------------------------------

As U can see from the above, no unique number is present in the XML string thus I would have to generate it before executing the insert statement.

I understand that there are 2 types of Insert statement.
One using the values(), the other using the return result from a select statement (subqueries).

Is it possible to use [values] and [select] in 1 insert statement? Or is there any way to insert into the customers table so that the ID column would display 1 for the first customer?

Thanks for your help."
   

- Advertisement -