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
 General SQL Server Forums
 New to SQL Server Programming
 Insert Into

Author  Topic 

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2011-07-16 : 15:46:00
Recently I upsized a Visual Foxpro 6 table to SQL. My Question is in regards to the "Insert Into", I created a backup table where I would like to copy a selected record to and it is an exact match for the original table. When I try to use the insert into command it says it completed but nevers transfers any data from the selected record. I also tried some variations of the command to see if I could nail it down but always got completed succesful but the record was never copied to the backup table. I included the command I used and I am hoping someone can explain to me what I did wrong. Also I would like to point that the original foxpro table had memo fields which were converted to a text field in SQL and I am wondering if this may be
an issue as well. So I guess a second question would be copy you in SQL do a Select * with the Insert Into, knowing that the table has large memo/test fields notes with it. Thanx. any help or pointers would be great.


INSERT INTO dbo.TMtest
SELECT * from TM.dbo.TM
WHERE TM.gpsunumb = 'U00213213'


INSERT INTO TMtest SELECT * FROM TM.dbo.TM
WHERE TM.gpsunumb = 'U00213213'

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-07-18 : 02:28:11
Try to execute your SELECT without INSERT.
Then you can see if there is a row retreived or not...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

dave8689
Starting Member

1 Post

Posted - 2011-07-18 : 02:52:57
may be u should try this
SELECT * Into NewTab
FROM TM.dbo.TM
WHERE TM.gpsunumb = 'U00213213'
Go to Top of Page

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2011-07-18 : 17:02:25
It does retrieve the correct record. Just never writes it into the
backup table.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-07-19 : 02:46:23
Please post the original inserte statement, the message after that insert and your select that's checking if the data is inside the destination table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2011-07-19 : 14:46:21
I have found that it will copy the record if I remove the notes
fields which were converted to an 'ntext' during the upsize from
foxpro to sql.

So with that said, is their a prefered field type I should be using.
I tried to convert the foxpro memo field to a SQL text field and it sill would not copy. Any ideas or suggestions would be great..
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-19 : 15:11:50
What version of SQL Server are you using?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -