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 |
suvis10
Starting Member
1 Post |
Posted - 2011-12-27 : 01:38:23
|
HiI am using sql 2005 .i want to create a new field using "after"i used below query but it says error:incorrect syntax near afteralter table sessions add speakercredential nvarchar(max) after SpeakerTitlecan u pls help me |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-27 : 01:48:27
|
You can't do that in SQL Server.Order of column in a table is irrelevant. You can specify the column order that you need in the SELECT statement. KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-27 : 02:24:57
|
quote: Originally posted by suvis10 HiI am using sql 2005 .i want to create a new field using "after"i used below query but it says error:incorrect syntax near afteralter table sessions add speakercredential nvarchar(max) after SpeakerTitlecan u pls help me
the column position in a table is fixed and is available from ORDINAL_POSITION column of INFORMATION_SCHEMA.COLUMNS view.Once created you cant change it.And as Tan points out its irrelevant as you can always return the columns in the order you want by specifying it in select list------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-12-27 : 08:02:52
|
quote: Originally posted by suvis10 HiI am using sql 2005 .i want to create a new field using "after"i used below query but it says error:incorrect syntax near afteralter table sessions add speakercredential nvarchar(max) after SpeakerTitlecan u pls help me
You can create a view that has columns with the preferred order. If you need it in a table, use SSMS design option to do thisMadhivananFailing to plan is Planning to fail |
|
|
|
|
|