Гость
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / ColumnA <> ColumnB / 4 сообщений из 4, страница 1 из 1
22.01.2001, 14:34
    #32001695
Andriuska
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ColumnA <> ColumnB
Здрасте всем...
А можно ли при помощи правила исключить возможность одинаковых значений в двух столбцах одной и той же записи, ну напрмер, ColumnA <> ColumnB
...
Рейтинг: 0 / 0
22.01.2001, 15:51
    #32001700
SergSuper
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ColumnA <> ColumnB
Нет, ведь правило не знает в какой таблице оно может оказаться.
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
22.01.2001, 18:12
    #32001706
Oleg F
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ColumnA <> ColumnB
Вообще-то для этой цели обычно CHECK constraint используется.
...
Рейтинг: 0 / 0
23.01.2001, 14:28
    #32001727
Andriuska
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
ColumnA <> ColumnB
Ну блин... Растяпа я, вот кто...
...
Рейтинг: 0 / 0
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / ColumnA <> ColumnB / 4 сообщений из 4, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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