Page 1 of 1

Check if view/query exists

Posted: Mon 02 Mar 2015 12:36
by oz8hp
I am trying to figure out a method of checking if a view/query exists in my DB using UniScript. But I haven't been able to figure out a way that works on MSSQL, MySQL, SQLite and Access.
Isn't this possible and could someone maybe give a hint as to what to look for.

Re: Check if view/query exists

Posted: Mon 02 Mar 2015 12:58
by AlexP
Hello,

The easiest way to check whether an object exists is using the TUniMetaData component: http://www.devart.com/unidac/docs/devar ... embers.htm . This will allow avoid writing separate queries for each database.

Code: Select all

  UniMetaData1.MetaDataKind := 'Tables';
  UniMetaData1.Restrictions.Add('TABLE_NAME=T_TABLE');
  ShowMessage(IntToStr(UniMetaData1.RecordCount));