Как я могу проверить, существует ли Представление в Базе данных?

Можно открыть файл на другой вкладке (Window-> New Window).

Выполнение, таким образом, у Вас есть две копии того же файла. Затем можно щелкнуть правой кнопкой по панели вкладок и выбору New Vertical Tab Group (или New Horizontal Tab Group, тот, который Вам нравится больше).

Надежда я понял Вас вопрос..

122
задан zzlalani 25 March 2017 в 07:50
поделиться

3 ответа

FOR SQL SERVER

IF EXISTS(select * FROM sys.views where name = '')
154
ответ дан 24 November 2019 в 01:20
поделиться

This is the most portable, least intrusive way:

select
    count(*)
from
    INFORMATION_SCHEMA.VIEWS
where
    table_name = 'MyView'
    and table_schema = 'MySchema'

Edit: This does work on SQL Server, and it doesn't require you joining to sys.schemas to get the schema of the view. This is less important if everything is dbo, but if you're making good use of schemas, then you should keep that in mind.

Each RDBMS has their own little way of checking metadata like this, but information_schema is actually ANSI, and I think Oracle and apparently SQLite are the only ones that don't support it in some fashion.

52
ответ дан 24 November 2019 в 01:20
поделиться

if it's Oracle you would use the "all_views" table.

It really depends on your dbms.

1
ответ дан 24 November 2019 в 01:20
поделиться
Другие вопросы по тегам:

Похожие вопросы: