Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename a Field
Message
 
 
To
04/08/2006 19:41:58
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01143132
Message ID:
01143135
Views:
11
>How can i test if a field exist in SQL SERVER Table and then rename it and change de field with, programaticaly.
IF EXISTS(SELECT * FROM MyDB.INFORMATION_SCHEMA.COLUMNS
		WHERE table_name = 'MyTable' 
			and column_name = 'MyColumnName')
  EXECUTE sp_rename N'dbo.MyDB.MyColumnName', N'NewColumnName', 'COLUMN'
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform