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
C#Microsoft SQL Server

Avatar of undefined
Last Comment
officedog
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.
Avatar of Krtyknm
Krtyknm
Flag of India image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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
Avatar of officedog
officedog

ASKER

Added select rights to table and worked.

Thanks
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo