How to rename or alter column name of the existing Table?http://forums.asp.net/t/1772927.aspx/1?How+to+rename+or+alter+column+name+of+the+existing+Table+Thu, 23 Feb 2012 11:02:54 -050017729274846975http://forums.asp.net/p/1772927/4846975.aspx/1?How+to+rename+or+alter+column+name+of+the+existing+Table+How to rename or alter column name of the existing Table? <p>Can any tell me How to&nbsp; rename or alter a column structure of the existing Table..</p> 2012-02-23T10:02:46-05:004846998http://forums.asp.net/p/1772927/4846998.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <p>hi,</p> <p>&nbsp;use <strong>ALTER</strong> Query to change the Column name in TABLE.</p> <p>for ex:</p> <p>ALTER TABLE table_name ALTER COLUMN column_name datatype.</p> <p>also refer below links,</p> <p>http://wwww.w3schools.com/sql/sql_alter.asp</p> <p>http://www.techonthenet.com/sql/tables/alter_table.php</p> <p>Thanks&amp;Regards,</p> <p>Arunabathan.G</p> 2012-02-23T10:10:15-05:004846999http://forums.asp.net/p/1772927/4846999.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <pre class="prettyprint">sp_RENAME 'TableName.[OldColName]' , '[NewColName]', 'COLUMN'</pre> 2012-02-23T10:12:10-05:004847011http://forums.asp.net/p/1772927/4847011.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <p>use this to rename column of table</p> <p>SP_RENAME 'TableName.ColumnName', 'NewColumnName', 'Column'</p> <p>replace TableName, ColumnName and NewColumName with proper values</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms188351.aspx">http://msdn.microsoft.com/en-us/library/ms188351.aspx</a></p> <p>to change column data type, or making it not null etc, u can use alter table syntx like this</p> &lt;div&gt;ALTER TABLE TableName<br> ALTER COLUMN column_name varchar(MAX)&lt;/div&gt; &lt;div&gt;&nbsp;&lt;/div&gt; &lt;div&gt;see complete list of alter table syntax&lt;/div&gt; &lt;div&gt;<a href="http://www.w3schools.com/sql/sql_alter.asp">http://www.w3schools.com/sql/sql_alter.asp</a>&lt;/div&gt; <p>hope this helps...</p> 2012-02-23T10:15:52-05:004847014http://forums.asp.net/p/1772927/4847014.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <p>Thank you aruna....I wanna set&nbsp; identity property to this column .</p> <p></p> <p>is this ok?</p> <pre class="prettyprint">ALTER TABLE table_name ALTER COLUMN column_name datatype identity(1,1)</pre> <p></p> <p></p> <p>But this is not working <img src="http://forums.asp.net/scripts/tiny_mce/plugins/emotions/img/smiley-cry.gif" alt="Cry" title="Cry" border="0"></p> 2012-02-23T10:17:24-05:004847047http://forums.asp.net/p/1772927/4847047.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <p>you can easily add new column in table&nbsp;as identity</p> <p>alter table TableName</p> <p>Add ColumnName int identity(1,1)</p> <p>but, to&nbsp;alter exisiting column and making it as identity is not straightforward... since, u might have some data in existing column which does not follow identity....</p> <p>this article explains the details</p> <p><a href="http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/">http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/</a></p> <p>hope this helps...</p> 2012-02-23T10:33:15-05:004847111http://forums.asp.net/p/1772927/4847111.aspx/1?Re+How+to+rename+or+alter+column+name+of+the+existing+Table+Re: How to rename or alter column name of the existing Table? <p>hi,</p> <p>&nbsp;please refer below links,</p> <p><a target="_blank" title="http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/" href="http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/">http://blog.sqlauthority.com/2009/05/03/sql-server-add-or-remove-identity-property-on-column/</a></p> <p><a target="_blank" title="http://stackoverflow.com/questions/1049210/adding-an-identity-to-an-existing-column" href="http://stackoverflow.com/questions/1049210/adding-an-identity-to-an-existing-column">http://stackoverflow.com/questions/1049210/adding-an-identity-to-an-existing-column</a></p> <p></p> <p>Thanks&amp;Regards,</p> <p>Arunabathan.G</p> 2012-02-23T11:02:54-05:00