Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Primarykeys

Author  Topic 

sujosh
Yak Posting Veteran

55 Posts

Posted - 2002-01-23 : 17:17:43
I am trying to get the primary keys and its datatypes in a trigger. When I tried to execute

EXEC sp_primarykeys @table_server = 'my server name',
@table_name = 'req',
@table_catalog = 'my db'

I get the following error "Server '10052' is not configured for DATA ACCESS."

What do I have to do to make it configured for Data Acess and secondly I also want to get the datatype of this primary key column

Thanks

izaltsman
A custom title

1139 Posts

Posted - 2002-01-23 : 18:02:42
Use sp_serveroption stored procedure to configure your linked server for data access.
Once you have the list of keys, you should be able to retrieve their datatypes via sp_columns_ex.



Edited by - izaltsman on 01/23/2002 18:03:07
Go to Top of Page

sujosh
Yak Posting Veteran

55 Posts

Posted - 2002-01-23 : 18:17:01
Thanks izaltsman!
Will do that..

Go to Top of Page

jbkayne
Posting Yak Master

100 Posts

Posted - 2002-01-23 : 19:52:39
I would recommend the following in your situation, this way you don't need to configure data access.

sp_pkeys
Returns primary key information for a single table in the current environment.

Syntax
sp_pkeys [ @table_name = ] 'name'
[ , [ @table_owner = ] 'owner' ]
[ , [ @table_qualifier = ] 'qualifier' ]



Go to Top of Page

sujosh
Yak Posting Veteran

55 Posts

Posted - 2002-01-24 : 11:34:24
Yes this is what I was looking for. Becasue the other way I dont have control over other servers in the field to set the sp_serveroption if it is not set already.

Thanks JBkayne!

Go to Top of Page
   

- Advertisement -