Reply to Re: Default value being a concatenation of other columns

Your name:

Reply:


Posted by Erland Sommarskog on 07/19/07 15:36

Drew (andylole@gmail.com) writes:
> Hello all,
>
> Does anybody know if it is possible to set the default value of a
> field to equal the concatenation of 2 other fields?
> I.E.
> Field 1 = 123
> Field 2 = 345
> Field 3 = (Field1 + Field2) = 123345
>
> This is easy enough to do using a stored procedure, but I'm trying to
> use the import tool and so need to do the concatenation by default.

No, but you can define a computed column:

CREATE TABLE nisse (kalle int NOT NULL,
lisa int NOT NULL,
putte AS kalle + lisa)

Of course, if you need to update the columns independently of each
other, this is not any feasible solution.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация