<?
$sql="";

$sql.= "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[pf_sensorxcamara_item]') AND type in (N'U'))\n";
$sql.= "BEGIN\n";
$sql.= "DROP TABLE [prefrio].[dbo].[pf_sensorxcamara_item];\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_sensorxcamara_item]') AND type in (N'U'))\n";
$sql.= "BEGIN\n";
$sql.= "CREATE TABLE [pf_sensorxcamara_item] (\n";
$sql.= "[LecturaDirModulo] smallint NOT NULL,\n";
$sql.= "[LecturaDirTipo] smallint NOT NULL,\n";
$sql.= "[id_item] smallint NULL,\n";
$sql.= "[id_status] nchar(1) NULL,\n";
$sql.= "CONSTRAINT [PK__pf_senso__0E08319713BCEBC1]\n";
$sql.= "PRIMARY KEY NONCLUSTERED ([LecturaDirModulo] DESC, [LecturaDirTipo] 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="";
?>

