Cowboy (Gregory A. Beamer) - MVP said:
I assume you mean something like:
INSERT INTO MYTable (col1, col2, col3)
SELECT * FROM MyOtherTable
If so, this is simply copying from a table in the database to your new table.
2. This SELECT statement has "WHERE (PrimaryKey = @@IDENTITY)". I "assume"
that @@IDENTITY represents the newly generated "primary key" for the record
that was inserted. Is that something internal to the processing generated
this?
Not sure about the @@IDENTITY portion of the statement, as I cannot see it
in context to the rest of the statement. @@IDENTITY does point to a newly
created item with an IDENTITY column. SCOPE_IDENTITY() is generally better to
use than @@IDENTITY, especially on high volume sites. It may not be
applicable here, however.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
No. the SELECT is "Selecting" from the same table (Births in both the INSERT
and the SELECT ). This is the Generated Insert statement by VB.NET. I'm
trying to figure out why the SELECT was generated. When I have writen an
INSERT, I have never followed it with a SELECT!!
INSERT INTO Births(NewspaperID, Date, Page, PageColumn, FatherFirst,
FatherMiddle, MotherFirst, MotherMiddle, MotherLast, First, Middle, Last,
DateOfBirth, DateOfBaptism, Church, Comments) VALUES (@NewspaperID, @Date,
@Page, @PageColumn, @FatherFirst, @FatherMiddle, @MotherFirst,
@MotherMiddle, @MotherLast, @First, @Middle, @Last, @DateOfBirth,
@DateOfBaptism, @Church, @Comments);
SELECT PrimaryKey, NewspaperID, Date, Page, PageColumn, FatherFirst,
FatherMiddle, MotherFirst, MotherMiddle, MotherLast, First, Middle, Last,
DateOfBirth, DateOfBaptism, Church, Comments FROM Births WHERE (PrimaryKey =
@@IDENTITY)
Bruce