Question : Need to Raname a field using SQL statement

We are having problems with a FIELD name using VB and therefore we need to rename it... We have tried many SQL statements we found out in the internet but were unsuccessful...
These are some options we have tried:

ALTER TABLE Presupuestos_detalle ALTER COLUMN [pvp_descto-pre-det] RENAME pvp_descto_det_pre

        Incorrect systax near pvp_descto_det_pre

ALTER TABLE Presupuestos_detalle RENAME [pvp_descto-pre-det] TO pvp_descto_det_pre

        Incorrect syntax near pvp_descto-det-pre

ALTER TABLE Presupuestos_detalle RENAME COLUMN [pvp_descto-pre-det] TO pvp_descto_det_pre

        Incorrect syntax near keyword 'COLUMN'

We cannot use the SQL Server to rename it... It must be done in our VB programme using a SQL statement, but we run out of options... Any other option? Thank U very much

Answer : Need to Raname a field using SQL statement

try the following

sp_rename 'Pedidos_cli_detalle.[pvp_descto-det-ped]' , 'pvp_descto_det_ped', 'COLUMN'


Rao
Random Solutions  
 
programming4us programming4us