|
You can use the following query to get a list of columns for a given table and use it to populate variables:
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME = 'Address'
You can rename a column using the following example:
EXECUTE sp_rename N'dbo.aaa.NewColumnName', N'NewColumnName2', 'COLUMN'
You can execute it from VB.NET, as well, by using the SqlCommand object and setting the CommandText property to the SQL code you want to execute. For a similar example, look at this expert answer on restoring SQL Server databases in VB.NET.
|