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 |
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2010-10-07 : 10:39:22
|
| Can you add a non-existing column, or function to a selection to provide ad-hoc, new column like an index?select employeeID, IDENTITY(int,1,1) as newcolfrom mytableHow do I get the syntax right? Is it possible? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-10-07 : 11:12:07
|
SELECT EmployeeID, ROW_NUMBER() OVER (ORDER BY EmployeeID) AS NewColFROM MyTable N 56°04'39.26"E 12°55'05.63" |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-10-07 : 11:24:33
|
| Note -- if you need this populated automatically when inserting new rows you'll need to set a default value with (probably) a function call.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|