<?
$sql="";
$sql.= "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[pf_camara]') AND type in (N'U'))\n";
$sql.= "BEGIN\n";
$sql.= "DROP TABLE [prefrio].[dbo].[pf_camara];\n";
$sql.= "END\n";

ejecutarsql($sql,$filas,$otro);
$sql="";

$sql.= "IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[pf_camara]') AND type in (N'U'))\n";
$sql.= "BEGIN\n";
$sql.= "CREATE TABLE [pf_camara] (\n";
$sql.= "[id_item] smallint NOT NULL,\n";
$sql.= "[id_camara] smallint NOT NULL,\n";
$sql.= "[nombre_item] varchar(100) NULL,\n";
$sql.= "[estado_actual] varchar(1) NULL,\n";
$sql.= "[tipo_item] varchar(20) NULL,\n";
$sql.= "[x] int NULL,\n";
$sql.= "[y] int NULL,\n";
$sql.= "[w] int NULL,\n";
$sql.= "[h] int NULL,\n";
$sql.= "CONSTRAINT [PK_pf_camara]\n";
$sql.= "PRIMARY KEY CLUSTERED ([id_item] ASC)\n";
$sql.= "WITH ( PAD_INDEX = OFF,\n";
$sql.= "FILLFACTOR = 100,\n";
$sql.= "IGNORE_DUP_KEY = OFF,\n";
$sql.= "STATISTICS_NORECOMPUTE = OFF,\n";
$sql.= "ALLOW_ROW_LOCKS = ON,\n";
$sql.= "ALLOW_PAGE_LOCKS = ON )\n";
$sql.= " ON [PRIMARY]\n";
$sql.= ")\n";
$sql.= "ON [PRIMARY];\n";
$sql.= "END;\n";

ejecutarsql($sql,$filas,$otro);
$sql="";

?>

