Link to home
Start Free TrialLog in
Avatar of officedog
officedog

asked on

Unable to access destination table in SqlBulkCopy c#

when attempting to use SqlBulkCopy with c#, I am getting the following error;

'Unable to access destination table'

I have googled various documents that refer to using the table/schema name are set as appropriate and have tried the following options;

Tablename
Schema.Tablename
[Schema].Tablename
[Schema].[Tablename]
Schema.[TableName]

All with the same results.

The user I am logging on with has limited rights, but does have Insert allowed for the table. Although it may be something to do with permissions, the message is not very helpful.

Any pointers as a little stuck.

Thanks
Avatar of Swindle
Swindle
Flag of United States of America image

Not sure if you even have the ability, but have you tried to manually insert something into the table?  Also, you might try fully qualifying it [database name].[schema name].[table name].  It's possible your connection string isn't getting you to the appropriate database.
Did you try the below link? I hope it helps.

http://www.codeproject.com/KB/database/SqlBulkCopy.aspx
ASKER CERTIFIED SOLUTION
Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of officedog
officedog

ASKER

Will try adding the database identifier when I get back to the office, but I know for sure the connection string is correct as it is a global setting and the dev server currently only has that DB on it. The same connection string can is also able to run existing stored procedures.

Will also try adjusting the user permissions to allow select.

Will update when I have tried both.

Thanks
Added select rights to table and worked.

Thanks