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
 Transact-SQL (2000)
 Help with an insert statement

Author  Topic 

jpotucek
Constraint Violating Yak Guru

273 Posts

Posted - 2008-01-30 : 15:03:09
Ran this to select 30 records from one table.

select * from tower.nbdocdeletedrecords with (nolock)
where PresentDate > '2008-01-01' and presentdate < '2008-01-19'
and [systemuser] = 'tower'
and polnum like '00u%'
and country ='50'


need to insert those 30 records into a second table EXCLUDING the first 2 and last 2 columns..

Here's a start (I think)

insert into tower.nbdoc
select * from tower.nbdocdeletedrecords with (nolock)
where PresentDate > '2008-01-01' and presentdate < '2008-01-19'
and [systemuser] = 'tower'
and polnum like '00u%'
and country ='50'

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-30 : 16:24:14
always List out the columns...

Insert into sometable (col1, col2....)
Select col1, col2, ...
From ...




Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -