• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 598
  • Last Modified:

How do I copy column A data to column B?

Hello.
I am using MS-SQL 2005 and trying to copy Entire COlumn A to new column which is columnB.
I used this query

Update BoardTable Set ColumnA=ColumnB
and it's now working. After I did this query, both column was filled with NULL value.
Help please.
Thank you
0
erin027
Asked:
erin027
  • 2
1 Solution
 
JimBrandleyCommented:
I hope you did a backup first, or wrapped it in a transaction then rolled it back. The problem is the order in which you named the columns. It should be:
Update BoardTable Set ColumnB=ColumnA

Jim
0
 
erin027Author Commented:
Thank you.
I have another question. How do I insert certain columns from different table?

Select (BoardTitle,BoardName) into NewTable From BoardTable where boardID>5 and boardid<10

I want to do something like top query. Is it possible, if it's possible then let me know. Thank you
0
 
JimBrandleyCommented:
INSERT INTO newTable(BoardTitle, BoardName) SELECT BoardTitle, BoardName FROM BoardTable
WHERE boardID > 5 and boardid < 10

Jim
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now