data into a different table.
How do I script the following.
If Field1 in Table1 is null, remove that row from Table1 and put it in
a new table called Table2
Regards,
CiarnCreate a newTable having the structure of Oldtable and write a query
Insert into newTable select * from OldTable where Field1 is null
delete from OldTable where Field1 is null
You can also use Trigger
Madhivanan|||Madhivanan wrote:
> Create a newTable having the structure of Oldtable and write a query
What is the quickest way to create a newtable with the structure of the
Oldtable? The Oldtable has over 50 fields, of many different types.|||chudson...@.hotmail.com wrote:
> Madhivanan wrote:
> > Create a newTable having the structure of Oldtable and write a
query
> What is the quickest way to create a newtable with the structure of
the
> Oldtable? The Oldtable has over 50 fields, of many different types.
Look in BOL under "generating scripts"
Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk|||The most performant (as it hardly touches the transaction log) and
easiest way to copy the data into a new table is to use the SELECT INTO
command. Loom in Books Online for more detailed information on this
command and why it is best for this kind of operation.
This will dynamically create a new table for you with all of the
required columns and their basic attributes.
You can then delete the copied records from the source table.
Regards,
Malcolm
www.dbghost.com|||The quickest way is to highlight the table in Query Analyzer and right
click create script.
No comments:
Post a Comment