I have been using the following query to identify the IDENTITY columns
in a given table. (The query is inside an application.)
select column_name
from information_sch ema.columns
where table_schema = 'user_a' and
table_name = 'tab_a' and
columnproperty( object_id(table _name), column_name, 'IsIdentity') = 1
This works. When "user_a" performs the query, everything is OK.
Now, another user wanted to use the same application. So, "user_b"
clicks on a button, and the exact same query as above is run. (No
substitutions are made; user_b is trying to see the identity column in
[user_a].[tab_a]). However, the query returns null, instead of the
identity column name. User_b can read the table and select from it
just fine.
Why am I getting two different results against the same query? Do I
need to rewrite the query to go against different information schema
views?
in a given table. (The query is inside an application.)
select column_name
from information_sch ema.columns
where table_schema = 'user_a' and
table_name = 'tab_a' and
columnproperty( object_id(table _name), column_name, 'IsIdentity') = 1
This works. When "user_a" performs the query, everything is OK.
Now, another user wanted to use the same application. So, "user_b"
clicks on a button, and the exact same query as above is run. (No
substitutions are made; user_b is trying to see the identity column in
[user_a].[tab_a]). However, the query returns null, instead of the
identity column name. User_b can read the table and select from it
just fine.
Why am I getting two different results against the same query? Do I
need to rewrite the query to go against different information schema
views?
Comment