View Single Post

   
  #1 (permalink)  
Old 02-23-2008, 06:23 AM
John C. Sullivan
 
Posts: n/a
Default INSERT by subquery behavior

If you use an INSERT INTO <table1> SELECT * FROM <other table2 with
same fields>, what is the behavior for the following situations:

1. Some (but not all) of the selected records in <table2> have
duplicates in <table1>? Does the entire statement fail or only for
rows with duplicates in <table1>?

2. Can I still do this statement if the indexes and column
*constraints* are different in <table2>? The columns themselves have
the same size and datatypes but there would likely be additional
indexes but fewer constraints on <table2>

3. Can the MERGE statement be used with a query to update multiple
rows and would this eliminate the issues above?
Reply With Quote