powered by simpleCommunicator - 2.0.40     © 2025 Programmizd 02
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / ColumnA <> ColumnB
4 сообщений из 4, страница 1 из 1
ColumnA <> ColumnB
    #32001695
Andriuska
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здрасте всем...
А можно ли при помощи правила исключить возможность одинаковых значений в двух столбцах одной и той же записи, ну напрмер, ColumnA <> ColumnB
...
Рейтинг: 0 / 0
ColumnA <> ColumnB
    #32001700
Фотография SergSuper
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Нет, ведь правило не знает в какой таблице оно может оказаться.
CREATE RULE rule
AS condition_expression

Arguments
rule
Is the name of the new rule. Rule names must conform to the rules for identifiers. Specifying the rule owner name is optional.
condition_expression
Is the condition(s) defining the rule. A rule can be any expression that is valid in a WHERE clause and can include such elements as arithmetic operators, relational operators, and predicates (for example, IN, LIKE, BETWEEN). A rule cannot reference columns or other database objects. Built-in functions that do not reference database objects can be included.
condition_expression includes one variable. The at sign (@) precedes each local variable. The expression refers to the value that is entered with the UPDATE or INSERT statement. Any name or symbol can be used to represent the value when creating the rule, but the first character must be @.
...
Рейтинг: 0 / 0
ColumnA <> ColumnB
    #32001706
Oleg F
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вообще-то для этой цели обычно CHECK constraint используется.
...
Рейтинг: 0 / 0
ColumnA <> ColumnB
    #32001727
Andriuska
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Ну блин... Растяпа я, вот кто...
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / ColumnA <> ColumnB
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]