in reply to Insert into DB problem

Please format your query in a legible manner if you want other people to look at it. Please tell us what the error is if you want people to help explain why it happens.

At first glance I see two things which may not be errors but which are not the best way to do things. First, take the connect statement out of the loop, or at a minimum replace it with connect_cached() - there's no reason I can think of to keep connecting again and again. Second, use placeholders!

On the error side ... do you really want two periods after "MeterMusciTemp"?

Replies are listed 'Best First'.
Re^2: Insert into DB problem
by pjofnj (Initiate) on May 25, 2005 at 16:01 UTC
    I need those periods there because I am inserting into a differnt database than selecting from. The query is as follows:
    Insert into MeterMusicTemp..QCStuff Select dictid,filename, 'SAVE A HORSE (RIDE A COWBOY)' from (select dictid, filename, artist, title, song, path, hholdid, updated_by, filesize from FMDATAFILE3 where PPMonth=424 and (RuleID >= 70 and RuleID < 80) and dictid in (select dictid from dictionary d, artist a, song s where d.artistid=a.artistid and d.songid=s.songid and artist='BIG & RICH' and song = 'SAVE A HORSE (RIDE A COWBOY)') and matchlevel<3) as T1 where lower(FileName) not like lower('%SAVE A HORSE (RIDE A COWBOY)%') + order by filename
    Thanks, PJOfNJ
      I need those periods there because I am inserting into a differnt database than selecting from.

      I don't know about whatever DBMS you're using, but ANSI SQL syntax for qualified table names is Catalog.Schema.Table or Schema.Table or Table. I suspect that what you are calling a database is a Schema and therefore you only want one period. If what you are calling a database is a catalog, then I suspect you need to put the Schema name between the two periods.