Alter Table Add + Sql Server 2005
Publicado por Cachilapo (33 intervenciones) el 24/01/2009 16:51:45
Hola buenos dias mi script para crear un campo nuevo en determinada tabla en deternimada base de datos es el sig:
Use BASEDATOS
If Not Exists (Select * From dbo.SysColumns col Inner Join dbo.SysObjects obj On col.Id=obj.Id
Where obj.Name='Tabla' And col.Name='Campo2')
begin
ALTER TABLE dbo.Tabla ADD
Campo2 char(16) COLLATE Modern_Spanish_CI_AI Constraint DF_tpunto_venta_cid_cuenve Default '' With Values NOT NULL
end
Me da esl sig: error...
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'COLLATE'.
Msg 319, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
No tengo ni la mas menor idea de que puede ser...
Sin mas a que hacer referencia...
Gracias por sus repuestas...
Use BASEDATOS
If Not Exists (Select * From dbo.SysColumns col Inner Join dbo.SysObjects obj On col.Id=obj.Id
Where obj.Name='Tabla' And col.Name='Campo2')
begin
ALTER TABLE dbo.Tabla ADD
Campo2 char(16) COLLATE Modern_Spanish_CI_AI Constraint DF_tpunto_venta_cid_cuenve Default '' With Values NOT NULL
end
Me da esl sig: error...
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'COLLATE'.
Msg 319, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
No tengo ni la mas menor idea de que puede ser...
Sin mas a que hacer referencia...
Gracias por sus repuestas...
Valora esta pregunta


0