Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update field with multiple other field values.

Status
Not open for further replies.

XopherS

Technical User
Dec 8, 2006
35
I'm using MS SQL Server 2000/2005. I want to add three fields' worth of data into a fourth field. If I were writing this in VB, I'd write something like

[tt]strNotes = strField1 & strField2 & strField3 & strNotes[/tt]

Is this even possible in SQL?
 
Okay, I appear to be on an interesting track...

Would it make sense to use an alias to combine the fields, create a new column in the table (newnotes), and update the column with the aliased info?

I'll keep searching Google...
 
You could create another field in the table to hold this data, but I wouldn't bother. Instead, leave it as seperate fields and then simply return the concatenated values when you need it.

The syntax would be something like this...

[tt][blue]
Select strField1 + strField2 + strField3 + strNotes As SomeField
From Table
[/blue][/tt]


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Would this work if I'm trying to migrate the data from DB.1 to DB.2, using DTS packages (or rather, its 2005 equivalent)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top