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
 Other Forums
 MS Access
 SQL Conversion, Identity property

Author  Topic 

Scutter
Starting Member

2 Posts

Posted - 2008-01-02 : 06:35:01
Greetings all

There are a number of customers which use a database on runtime access, some of these wish to convert to SQL but do not have the upsizing wizard with runtime. I have created a VBA script which converts the database structure to SQL and it works fine and does exactly what I want it to. The problem comes trying to insert the data..

I use 'dBase.ExecuteImmediate "SET IDENTITY_INSERT " & tdf.Name & " ON"' so that I can insert the existing autonumber value into the Identity field but I get the following error when the script runs on a table with no Identity field
'Table x does not have the identity property. Cannot perform SET operation'

Does anybody know how I can check if the identity property exists for a table?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-01-02 : 06:44:24
[code]Select OBJECTPROPERTY(object_id('table_name'), 'TableHasIdentity')[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Scutter
Starting Member

2 Posts

Posted - 2008-01-02 : 07:16:50
Thanks for the reply, but I'm not sure how I would read the result from within access.
Go to Top of Page
   

- Advertisement -