hi everybody,
i'm trying to do some select queries on nav using odbc,the problem is when i select a table which name doesn't contain a space everything seems to be working .but when the table name contain a space i have no error and no result. i wich someone would help me. thanks
ps:sorry for my english i'm doing my best
Comments
Ex: Select {field list} from [dbo].[CompanyName$Sales Header]
i've tried this but it doesn't work :
$query = "SELECT {Ressource No_,Ressource Group No_} FROM [Nav51_171008].[Cosmos 5.01 Resource / Resource Group]";
try :
$query = "SELECT {Ressource No_,Ressource Group No_} FROM [Nav51_171008].[Cosmos 5_01 Resource _ Resource Group]";
the characters "\/." are replaced by "_" in SQL.
Regards,
Willy
i already tried it but its not working. for the odbc configuration i've choosed in the identifiers option "All Except dot" so i think all the caracters are transfered like they are except the dot which is remplaced by _.other ideas ?!
sorry for my english :$ i'm doing my best
i've tried something and it seems to be working but i have another problem.
for the query i've tried this :
$query = "SELECT 'Resource No_','Resource Group No_' FROM \"Resource / Resource Group\" ";
but when i use the php function ;
$num_r = odbc_result($result,'Resource No_');
i get an error :
Warning: odbc_result() [function.odbc-result]: Field Resource Group No_ not found .
i'm using a php script to get data from nav.the problem is that its works on the tables "resource","group" and "Group / Group resource" but it doesn't work on the table "Job" and "Job Task".
here is the script.
$query = "SELECT 'No_','Search Description','Description','Subject','Finished','Job Type' FROM Job"; // on récupère les ressource de type 0 et statut 1 et 0
$result = odbc_exec($link2,$query);// on test la connection
if (!$result)
{
print("Execution import resource failed:\n");
print(" State: ".odbc_error($link2)."\n");
print(" Error: ".odbc_errormsg($link2)."\n");
}
else
{
print("Execution was successful for the table Job.\n");
while(odbc_fetch_array($result))// on parcours la table employee sur nav
{
$num = odbc_result($result,'No_');
$ind = mysql_query("SELECT COUNT(*) as count FROM affaire WHERE Code_Affaire like '$num'");//on recherche si la ressource n'existe pas deja
if ($ind) $res = mysql_fetch_array($ind);
if($res == 0)// on teste si 0 nexiste po si 1 existe et donc on najoute po
{
$des = odbc_result($result,'Search Description');
$des2 = odbc_result($result,'Description');
$sub = odbc_result($result,'Subject');
$fin = odbc_result($result,'Finished');
$type = odbc_result($result,'Job Type');
mysql_query("insert into affaire values('$num','$des','$des2','$sub','$fin','$type')");
}
}
i want to know if there is a difference between those tables on nav