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
 delete columns while import

Author  Topic 

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-19 : 12:22:45
how can i delete some columns before i import the file to the dbo??
i tried to delete some columns before import the dataset to the dbo and the data from the columns i deleted were transported to the last column

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-19 : 12:24:30
delete columns from where? table or excel? please specify
Go to Top of Page

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-19 : 15:24:09
i am trying to import a .txt file to sql server 2005 with the import tool
i want to find a way to delete 3 columns before the import
because if i delete them later i have duplicate records on the pk and i dont know how to delete the duplicate records
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-19 : 15:33:37
quote:
Originally posted by constantinos1987

i am trying to import a .txt file to sql server 2005 with the import tool
i want to find a way to delete 3 columns before the import
because if i delete them later i have duplicate records on the pk and i dont know how to delete the duplicate records



How would deleting columns which are a part of pk help you ?
Go to Top of Page

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-19 : 16:54:29
i dont delete columns part of pk.
when i delete the columns duplicate records are created
and i dont know how to handle them
Go to Top of Page

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-19 : 16:55:23
i am sorry if i confused you. my english aren't very good
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-20 : 01:01:49
quote:
Originally posted by constantinos1987

i am sorry if i confused you. my english aren't very good


didnt understand how you get duplicate records when you delete.or do you mean deleting more records than whats actually reqd due to duplicate field values? in any case, post some sample data and illustrate.
Go to Top of Page

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-20 : 07:38:12
i am trying to import some data to a new dbo
the import file has 9 columns. i need only the 6 of them
deleting the columns 7,8 & 9 i have 6 columns but with a lot of duplicate records and it is a huge file.....

for example....

672935,54866,374,2,2004-02-27 17:06:00,True,0000000012558,1,1.49
672935,54866,374,2,2004-02-27 17:06:00,True,0000000013142,1,1.1799999
672935,54866,374,2,2004-02-27 17:06:00,True,0000000037239,1,1.38999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000002013,1,1.22
672936,55123,374,1,2004-05-07 08:38:00,True,0000000003043,2,0.81999999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000022976,1,1.399999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000101276,1,1.600000
672937,55724,374,2,2004-08-05 08:53:00,True,0000000001033,1,3.890000
672937,55724,374,2,2004-08-05 08:53:00,True,0000000019220,1,5.129999

after the delete....

672935,54866,374,2,2004-02-27 17:06:00,True
672935,54866,374,2,2004-02-27 17:06:00,True
672935,54866,374,2,2004-02-27 17:06:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672937,55724,374,2,2004-08-05 08:53:00,True
672937,55724,374,2,2004-08-05 08:53:00,True

at the data i present you can see that some rows are identical. i want to find a way to delete them
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-20 : 09:02:38
Are you using sql 2005?
Go to Top of Page

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-20 : 14:05:10
i use sql server management studio 2005
Go to Top of Page
   

- Advertisement -