We have a DTS package from an MS ACCESS database to a SQL Server 2000 database. One of the tables ENGR_ITEM had an index on it in ACCESS, but you can't see it in the object list in Enterprise Manager. The only way you know the index is there is if you try to create a primary key on the table and then save it. It won't let you save it because it says it already has a primary key from the index. You would think you would be able to see it if it existed. Does anybody find that weird?If you run:
exec sp_pkeys 'your_table_name'
it should return the current pk for the table.
Or you can use objectproperty() function to check for existence of index/constraint on a table.
e.g.
select objectproperty(object_id('your_table_name'),'TableHasPrimaryKey')
See book online for more info on objectproperty() function.|||Thank you for your information on how to find the indexs/constraints on tables. Very helpful of you to provide that. I'm still wondering though why the index didn't appear in the Object Explorer. It obviously got created through the DTS package.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment