Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set IDENTITY_INSERT on Append Query (please help fix my sql)

Status
Not open for further replies.

sisieko

Programmer
Joined
Jun 13, 2004
Messages
56
Location
US
Does anyone have any idea what i am doing wrong here? I am getting error 3078, Input or query not found. But my table exists in tht location.

Code:
SQLstr12 = ("SET IDENTITY_INSERT statusCodes ON " & _
"INSERT INTO statusCodes (statusCode, statusDescription, statusSortOrder, shortStat) " & _
"SELECT [Status Code], [Status Description], [Sort Order], [Short Stat] FROM [Status Codes] IN '" & strOldDBpath & "';")
db.Execute SQLstr12, dbFailOnError

 
I'm not sure if I'm just not familiar with the SET statement, or you're just way off?

SQLstr12 = "INSERT INTO statusCodes (statusCode, statusDescription, statusSortOrder, shortStat) " & _
"SELECT [Status Code], [Status Description], [Sort Order], [Short Stat] FROM [Status Codes] WHERE txtSomething IN (" & strOldDBpath & ")"

Are you trying to duplicate a record?
Is it possible this way? (locking Issue?)
 
Missing WHERE clause.

The SET is fine (assuming you're connecting to a SQL Server).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top