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 2005 Forums
 Transact-SQL (2005)
 BULK INSERT to add a column to a table

Author  Topic 

shaw
Starting Member

15 Posts

Posted - 2007-04-30 : 22:29:48
hi there again,

i have the following issue:

i have a table named poolp
in that table i have a column named poolp

now i need to add another column named date
i come to object explorer, i come to tables --> poolp --> columns
then right click, new column and then design it as a datetime column, and allow it to be null because otherwise it doesn't let me alter the table by adding a new column.

then what I want to do is to fill the rows of my date column in poolp table by the values from my date.txt file.
i go like this:

BULK INSERT poolp(date)
from 'c:\date.txt'

the above code does not work because i realized poolp(date) does not take me to the date column of the poolp table.

any idea about how to insert the values in a txt file to a specific column of a table?

thank you.



jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-04-30 : 23:24:24
you could bulk insert your dates into a separate staging table, poolp_date_stage, then do an update in poolp, joined with your staging table.

poolp. that's a funny table name btw.


www.elsasoft.org
Go to Top of Page
   

- Advertisement -