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.
| Author |
Topic |
|
clinton_eg
Yak Posting Veteran
60 Posts |
Posted - 2010-06-10 : 08:33:27
|
HiIm trying to use a the Computed Column option in Column properties in Microsoft SQL Server Management StudioIm want to create a unique ID by combining the value of two existing columns in a TableExample:Column 1 = datetimeColumn 2 = varchar(30)I want column 3 to create a unique ID by adding Column1 and Column2.So when i upload data into the table using a DTS or SSIS package, Column 3 gets populated with the required Unique ID.I get an error when i try to add in the (Formula) field under Computed Column Specification:Column 1 + Column 2Error: Error validating the formula for column 'Column 3' Do you want to cancel your changes?Im sure im not doing something right . Please helpEwan Gilby |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-06-10 : 08:38:15
|
you need to convert Column 1 to string first before concatenate with column 2check out convert() in BOL KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
clinton_eg
Yak Posting Veteran
60 Posts |
Posted - 2010-06-10 : 09:29:06
|
| i triedconvert(varchar(20),[Column 1],101)+[Column 2]but still get the errorEwan Gilby |
 |
|
|
|
|
|