Active Query Builder support area

FindViewByName etc

Avatar
  • updated
  • Completed

Sorry for the daft question but ....

FindViewByName etc takes three arguments llAName llASchema llADatabase

llAName and llADatabase I know for the view I am looking for

Would it be possible to make these commands work with a blank llASchema as I'm not sure how I would know this value in advance ?

I see there is a collection called DefaultSchemas but I'm not 100% sure how this could help me

Yes obviously on a test basis I can look in SSMS and see the schemas but how do I know more generically ?

Avatar
Andrey Zavyalov, PM

I don't know your database structure: if it support schemas or databases. but if any of them aren't supported by youd database server, you can leave corresponding parameters blank, it's allowed.

Avatar
Andrew Kennard

We are mostly using MSSQL so schemas are supported but we don't use them

If dbo is always the correct value then I could hard code this but I suspect it won;t always be

I did try leaving the schema blank but it did not find the table

Avatar
Andrey Zavyalov, PM

This method finds specific database object in the Metadata Container (with specific database, schema and object name), so you should specify all parameters correctly in order to find an object.

Avatar
Andrew Kennard

Now that DefaultSchemas.Count etc work then I guess all I can do is loop though these calling FindViewByName until I find a match.

I suspect in most cases there will only be the dbo schema