Many pieces of code are supplied to help you help me......
Heres the Stored Procedure that gets called:
Alter Procedure CheckThis
CODE IN USE:
declare tab_cursor cursor
for SELECT substring(b.name,1,30) as tableName
FROM syscolumns a, sysobjects b
WHERE a.name = 'USER_ID' and b.name not in ('Address', 'staff',
and a.id=b.id order by tablename
where user_id = 193"
the field USER_ID appears in about 20 tables, I need to ability to
determine if the USER_ID is used in any of the tables except those I
excluded. Being basically lazy, plus I want a flexible solution, should
someone add another table that uses USER_ID I have done the following:
1) Query the syscolumns table for USER_ID and join with sysobjects to
3) execute the dynamically generated query and return the value (in this
case a count for that User_id in that table)
4) Loop through all tables that use User_id
How can I get the count from the query and evaluate it, All I currently
get are 0's, and there are many tables where it is much greater than 0.
Thanks in advance for help.