Re: copying the column values of a Datatable into another data table in vb.net
- From: "Cindy Winegarden" <cindy_winegarden@xxxxxxx>
- Date: Tue, 3 Jan 2006 19:47:53 -0500
Hi Balu,
Are you saying that you want to add a new column to a table and populate it
or populate a column that's already there but is empty? To do that you'll
need to use an update statement and connect the record in the source table
to the record in the target table via a primary key. It's not as easy as
copying/pasting a column in Excel, for example.
In a SQL Server script this would be something like:
Alter Table Target Add NewColumn Integer
Go
Update Target
Set Target.NewColumn =
(Select Source.OldColumn From Source
Where Source.PrimaryKey = Target.PrimaryKey)
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@xxxxxxx www.cindywinegarden.com
"Balu" <balu@xxxxxxxxxxxxxxxxxx> wrote in message
news:eYXluyBEGHA.1676@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
> Its working fine.But,i wanna copy only one column of a table not the
> entire data.
> But,the statement .....
> tblTwo=tblOne.Copy()
> copies the entire data,i.e.,all column values into another table.
> Can anybody give a solution for it?
>
> Regards,
> Maha.
> "Cindy Winegarden" <cindy_winegarden@xxxxxxx> wrote in message
> news:Ovl72T6DGHA.208@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi Mahalakshmi,
>>
>> Does the Copy() method that Christopher Reed suggested in your other
>> thread work for you?
>>
>>> tblTwo = tblOne.Copy();
>>
>> --
>> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
>> cindy_winegarden@xxxxxxx www.cindywinegarden.com
>>
>>
>> "Balu" <balu@xxxxxxxxxxxxxxxxxx> wrote in message
>> news:OuE1%2324DGHA.740@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hi All,
>>>
>>> Can anybody tell me how to copy one column of a data table to another
>>> data table.
>>>
>>> Example:I have 2 data tables say dt1,dt2.
>>> Here,i wanna copy only the 1st column values of dt1 into the 1st column
>>> of dt2.
>>> Its an urgent work for me.So,anyone of you can give me a solution to
>>> this.
>>>
>>> Regards,
>>> Mahalakshmi.
>>>
>>
>>
>
>
.
- Follow-Ups:
- References:
- Prev by Date: Re: Help Out from this.....
- Next by Date: Video presentations???
- Previous by thread: Re: copying the column values of a Datatable into another data table in vb.net
- Next by thread: Copying data of one data table to another data table.
- Index(es):
Relevant Pages
|