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)
 Insert into

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-03-17 : 05:00:46
hello,
i would like to select all columns in my db which are of integer value into another table and delete the entries in the table

I am using

insert into sms_phonebook2 (select * from sms_phonebook
where nickname like '23480%')

But its giving an error, i cant remember the syntax now, and also to delete all the entries selected

Kristen
Test

22859 Posts

Posted - 2005-03-17 : 05:03:58
[code]
select *
into sms_phonebook2
from sms_phonebook
where nickname like '23480%'

-- Delete entries now in sms_phonebook2
DELETE D
FROM sms_phonebook D
JOIN sms_phonebook2 S
ON S.MyPK = D.MyPK
[/code]
Kristen
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-17 : 05:05:49
use the ISNUMERIC function.
I have to ask though, why do you have to insert them into another table?
why not just delete the ones you don't want ?

this is the syntax for SELECT INTO
SELECT col1,col2,,,, INTO newTable FROM oldTable



rockmoose
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-17 : 05:07:36
Hey Kristen, I think there must be something wrong with your postcount

rockmoose
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-03-17 : 05:11:44
I'm using the new SQL Team - "SQL Timewarp"

It allows me to post other users answers before they wrote them!

Kristen
Go to Top of Page
   

- Advertisement -