.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Permission Denied to SA on Bulk insert

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :Sql Server
Dear All,I am experiencing strange problem (SQL 2005, build 9.0.1399), receiving following error:Msg 4834, Level 16, State 4, Line 1You do not have permission to use the bulk load statement.I am running the stored procedure SP1.  This stored procedure calls another one, SP2.  Stored procedure SP2 contains a dynamic SQL statement to insert data into the temporary table, created by SP1 and given to SP2 via parameter name.Something like:SET @szSQL = 'BULK INSERT ' + @TName + ' FROM ' + '' + @FilePath + '' +  ' WITH ( ' +   ' DATAFILETYPE = 'char', ' +      ' FIELDTERMINATOR = ' + '' + @Terminator + '', ' +      ' ROWTERMINATOR = '\n' ' + ' ) 'EXEC (@SQL)If I execute SP1 I receive an errorMsg 4834, Level 16, State 4, Line 1You do not have permission to use the bulk load statement.But I can execute SP2 with no problem.All operations are done under SA login.Any thoughts/ideas?Thanks

View Complete Post

More Related Resource Links

Insert permission was denied on Object '', database '', schema ''

i have a senario where in i am trying to insert data into a Database , i end up getting the above error 'Insert permission was denied on Object '', database '', schema '''.We have a DB which has all Storeprocedures and 90% of the tables . the remaining 10% of the tables are in a different database.I am having trouble inserting data into the second database.The storeprocedure is executed as a user who has permission on the DB and tables.Also the storeprocedure is given permission to a role in which the user is a member . The same role doesnt exists in the 2nd Database.I am able to do all DB operations in one environment . i am unable to do the same in the others.


Can I bulk insert to specific columns when bulk inserting a text file or do I have to bulk insert into all columns of a table? The extra column in the table is an identity integer. So I had to create a view without the identity integer to make it work. Maybe there is a more direct way?? If so what would be the syntax? I am a beginner to intermediate SQL guy.   strSQL = "BULK " & _        "INSERT CustomersUpload " & _        " FROM 'C:\MydataFile.txt' " & _        " WITH " & _        " ( " & _        " FIELDTERMINATOR = '|', " & _        " ROWTERMINATOR = '\n' " & _        " )" Thanks

Windows 7 CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 26

Hi I have migrated to a new computer using Windows 7, 6 gig memory, I7 chip (old machine had xp) and have installed Visual Studio 2008 and  SQL Server 2008 R2.  I get CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262) when I try to create a new database.  Other posts (example:http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/28fee0ed-c7e2-40df-8f79-f513c9848f09/) work for Vista but I cannot find how to grant permissions.  Run as administrator (vista fix) does not work. I have admin privaleges on my machine.  There are no other accounts.    What do I need to do to update privaleges? Thanks and have a nice day.    

access denied execute permission (how to resolve?)

hi theremy company create for me a new database in new server hostingthe problem is that with new user's database, i cannot execute SPit return error that the user "username" do not have execute permissionthe actual permission are :db_datareader,db_written,db_ddladminit seems not enoughtmust i ask for add  db_owner schema rom to user?

The SELECT permission was denied on the object 'sysjobs_view', database 'msdb', schema 'dbo'.

So, I have an SSIS package that uses a transfer jobs task between Server A and Server B.  When I run the package with my credentials, everything works fine.  However, when I run the package from an SSIS using a different user, I get the following error: Date 9/1/2010 8:00:00 AM Log Job History (xxx) Step ID 1 Server xxx Job Name xxx Step Name Run SSIS Duration 00:00:01 Sql Severity 0 Sql Message ID 0 Operator Emailed Operator Net sent Operator Paged Retries Attempted 0 Message Microsoft (R) SQL Server Execute Package Utility Version 10.0.2531.0 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 8:00:00 AM Error: 2010-09-01 08:00:01.39 Code: 0xC002F325 Source: Transfer Jobs Task Transfer Jobs Task Description: Execution failed with the following error: "An exception occurred while executing a Transact-SQL statement or batch.". End Error Error: 2010-09-01 08:00:01.39 Code: 0xC002F325 Source: Transfer Jobs Task Transfer Jobs Task Description: Execution failed with the following error: "The SELECT permission was denied on the object 'sysjobs_view', database 'msdb', schema 'dbo'.". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 8:00:00 AM Finished: 8:00:01 AM Elapsed: 0.75 seconds The strange thing is, the user running the job ahs sysadmin permissions

Parent window does not get reloaded - Permission denied error

Hi, When a button from a web form (say parent) is clicked I am opening another form(say child). And once the child completes its processing, it has to reload the parent form and close itself. For this I am calling the below javascript in the child form: function CloseMe() {     window.opener.location.reload(true);    self.close();    } But when the browser tries to execute this javascript code, it fails and throws Permission denied error. Here, the parent and child forms are from different domains. Please throw somelight on this. Thanks!  

Errors during bulk insert

Hi, While writing a stored procedure in SQL 2008, for a bulk insert, I am getting several errors. Part of the SP is written below for your reference. Need to know where am I going wrong. Any help will be thankfully acknowledged.-Learn24x7----------CREATE PROCEDURE Sp_BulkInsert(@Directory nvarchar(256), @TblName nvarchar(50), @Collation nvarchar(50), @FieldSeparator nvarchar(50),    @RowTerminator nvarchar(50))ASBEGIN    SET NOCOUNT ON;                BULK INSERT [@TblName]    FROM ''+@Directory+'' --Error1: see below    WITH --Error2: see below     (     FIRSTROW = 2,     CODEPAGE = (SELECT CAST(@Collation AS INT)), --Error3: see below     FIELDTERMINATOR = ''+@FieldSeparator+'',     ROWTERMINATOR = ''+@RowTerminator+''     )  ENDGO----------FROM ''+@Directory+'' --Error1: An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.WITH --Error2: Incorrect syntax near the keyword 'with'. If this statement is a commo

Cant create new database / CREATE DATABASE permission denied in database master (error 262)

   I am using SQL express and Visual web developer on windows Vista. When I try to create a new database the following message appears.   CREATE DATABASE permission denied in database master (error 262) I log on to my computer as an administrator. Help appreciated  Prontonet      

Unable to prepare the SSIS bulk insert for data insertion

Hi,   I am using SQL Server Destinations in my data flow tasks. I'm running this package in the server until i encountered this error:   OnError,,,LOAD AND UPDATE Dimension Tables,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion. OnError,,,Load Dimensions,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1071636367,0x,Unable to prepare the SSIS bulk insert for data insertion. OnError,,,Discount Reason, ISIS Condition, ISIS Defect, ISIS Repair, ISIS Section, ISIS Symptom, Job Status, Parts, Purchase SubOrder Type, Service Contract, Service Reason, Service Type, TechServiceGrp, WarrantyType, Branch, Wastage Reason,,,10/24/2007 1:22:23 PM,10/24/2007 1:22:23 PM,-1073450974,0x,SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Dim_T_ISISDefect" (56280) failed with error code 0xC0202071. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure. What could be the reason for this? I don't usually have an error.   cherriesh

SQL ServerDestination error - Unable to prepare the SSIS bulk insert for data insertion.

Having searched the forum, this one clearly has form... However beyond assisting those who have fallen at the first hurdle (i.e. forgetting/not knowing that they cannot execute the package remotely to the instance of SQL Server into which they are inserting), the issues raised by others have not been addressed. Thus I am bringing nothing new to the table here - just providing an executive summary of problems which others have run into, written about, but not received answers for.   First the complete error: Description: Unable to prepare the SSIS bulk insert for data insertion.  End Error  Error: 2008-01-15 04:55:27.58     Code: 0xC004701A     Source: <xxx> DTS.Pipeline     Description: component "<xxx> failed the pre-execute phase and returned error code 0xC0202071.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  4:53:34 AM  Finished: 5:00:00 AM  Elapsed:  385.384 seconds.  The package execution failed.  The step failed.   Important points It mostly works - It produces no error more than 9 times out of 10. It fails on random dataflows - My package has several dataflows, (mostly) executing concurrently. Where the error occurs it does not do so on the same dataflow each time: on one run it'll fail on dataflow A whilst B,C,D and E succeed, then A-E will all succeed (and continue doing so for the next ten runs thereafter), and

Select Permission Denied on object

Hello all, I have just begun to develop a simple web application to maintain phone book / contact details of people. I have been facing problems wrt the connection to the database, while trying to execute the reader it throws this error - Server Error in '/phonebook' Application. SELECT permission denied on object 'PhoneBook', database 'Northwind', owner 'dbo'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: SELECT permission denied on object 'PhoneBook', database 'Northwind', owner 'dbo'. Error occurs at - reader = cmd.ExecuteReader(); The stacktrace looks like this -[SqlException: SELECT permission denied on object 'PhoneBook', database 'Northwind', owner 'dbo'.]   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742   System.Data.SqlClient.SqlCommand.ExecuteReader() +42   Phonebook.ResultPage.CreateDataSource() in c:\inetpub\wwwroot\phonebook\resultpage.aspx.cs:56   Phonebook.ResultPage.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\phonebook\resultpage.aspx.cs:39   System.Web.UI.Control.OnLoad(EventArgs e) +67   System.Web.UI.Control.LoadRecursive() +35    Syste

Get error message from bulk insert task.

Hello, I've created a dtsx package that bulk inserts some data from a csv file into a sql table (using the BULK INSERT TASK). Because this package is scheduled to run automatically, I also added a EXECUTE SQL TASK that will insert a row in a 'log table'. It is linked to the BULK INSERT task with a 'Succes constraint (green arrow)', so I know about all the successes. But I am more interested in the failures, so I also added another EXECUTE SQL TASK and linked it to the BULK INSERT task with the 'failure constraint (red arrow)'. Question: How can I get the error message from the BULK INSERT TASK (like 'file does not exist' or 'error converting .....') and store it in a field in the 'log table'? Thanks in advance, Peter

How to do a parameterized bulk insert into SQL Server 2008 R2 from C# (.NET 4.0)

Hi, I'm trying to execute a BULK INSERT with a parameterized SqlCommand from a C# .NET 4.0 project. This is the code: private System.Data.SqlClient.SqlCommand sqlCmd2; private string sqlCmd2String = "BULK INSERT ExchangeTrackingLogs.dbo.ParsedLogs FROM @name WITH (FIELDTERMINATOR=',', ROWTERMINATOR='\n', FIRSTROW=2)"; private System.Data.SqlClient.SqlParameter[] sqlCmd2Params = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar) }; (...) sqlCmd2Params[0].Value = source; sqlCmd2.Parameters.Clear(); sqlCmd2.Parameters.AddRange(sqlCmd2Params); sqlCmd2.ExecuteNonQuery(); where source is a string containing the full path to a file, i.e. a value "C:\\TEMP\\MSGTRK20100701-1.LOG_EXHUB01". When I execute this code, I get an Exception with Message "Incorrect syntax near '@name'." In the database trace I see an RPC:Completed event with TextData equal to exec sp_executesql N'BULK INSERT ExchangeTrackingLogs.dbo.ParsedLogs FROM @name WITH (FIELDTERMINATOR='','', ROWTERMINATOR='' '', FIRSTROW=2)',N'@name varchar(36)',@name='C:\TEMP\MSGTRK20100701-1.LOG_EXHUB01' I tried using verbatim string literals, but doesn't seem to help. Any idea?

The EXECUTE permission was denied on the object 'proc_UpdateVirusInfo'

Hi All,   SharePoint 2007 x64 w/SP1, SQL 2005 x64, ForeFront for SharePoint w/SP1, running on Windows Server 2003 x64 R2 w/SP2.   We originall setup this server using only a couple service accounts. That was a bad idea so a few weeks ago I went over everything and setup or service accounts according to Microsofts recommendations. (http://technet.microsoft.com/en-us/library/cc263445.aspx)   I've gone over the requirements a dozen times and everything is set perfect.   I have two issues.   1. Randomly we have a SQL permission issue popping up, this abouts a couple times a day (some days none), the event log will fill about with anywhere from 15 to 800 of the same event.   Event Type: ErrorEvent Source: Windows SharePoint Services 3Event Category: Database Event ID: 5214Date:  3/11/2008Time:  1:28:30 PMUser:  N/AComputer: TRUMANDescription:Insufficient SQL database permissions for user 'PortalPool' in database 'SharePoint_AdminContent_45f0f48e-c1b1-463c-99e3-ea6648beaf37' on SQL Server instance 'Truman'. Additional error information from SQL Server is included below. The EXECUTE permission was denied on the object 'proc_UpdateVirusInfo', database 'SharePoint_AdminContent_45f0f48e-c1b1-463c-99e3-ea6648beaf37', schema 'dbo'. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.   PortolPool is our service account for the IIS Poo

EXECUTE permission denied on sp at web host

Hi all, I have recently succeeded doing a Publish to server from my local sql db and run the sql script on my web host's sql server 2005 db. Now, I get the "The EXECUTE permission was denied on the object 'MyStoredproc', database 'db12345', schema 'dbo'." error. I have Visual Studio Professional 2010, and that's where I create and manage my tables (in Server Explorer). However, when I right-click a stored procedure, I don't get a Seurity option or the like, where I could possibly set permissions. I'm a bit usure of what SqlServer applications I have installed (as they are intertwingled with the Aps.Net stuff somewhat). When I look at Add/Remove software, this is what I find: Microsoft Sql Server 2008 (562 MB)Microsoft Sql Server 2008 Native ClientMicrosoft Sql Server 2008 R2 Data-Tier Application FrameworkMicrosoft Sql Server 2008 R2 Data-Tier Application ProjectMicrosoft Sql Server 2008 R2 Management ObjectsMicrosoft Sql Server 2008 R2 Transact-Sql Language ServiceMicrosoft Sql Server 2008 Setup Support FilesMicrosoft Sql Server Compact 3.5 SP2 ENUMicrosoft Sql Server Database Publishing Wizard 1.3Microsoft Sql Server Database Publishing Wizard 1.4Microsoft Sql Server System CLR TypesMicrosoft Sql Server CSS Writer Can I use any of these apps to set the security settings? Or would I possibly not be allowed to change any settin

Bulk Insert Problem

I am trying to perform a bulk insert on pipe delimited file (approx 25 columns,5000+ rows of data).  Normally this is no problem however this file has a header and trailer record with no delimiters (1 column).  I could use a utility like grep to remove the header/trailer record but I would like to capture the entire file inside sql server. I can bulk insert the entire file into a single column (wide) that would include the delimiters.  My problem from there is to process the single column data into the appropriate rows /columns.  I am looking for a set solution as opposed to a cursor type solution. HTML?  Seems slow.  Cross Apply?   Changing the file format is not a viable solution. I’m likely to have more than a few of these oddball formats with a variable number of columns.  Any ideas?   I thank you for your time on this puzzle.

Bulk insert CSV files

Hello, I am trying to Bulk Insert a CSV file, and I can't seem to find the row terminator. When I use \m I get an error message that an unexpected EOF has occurred, which usually means a carriage return at the end of the file. I removed the carriage return from the file, but I am still getting the same error message. I have tried the following row delimiters... \r,\n,{CR},{CR}{LF}. These work as the data is indeed bulk loaded into the table, however it dumps the majority of the data in the last column, so 7 or 8 columns are stuffed into 1. Has anyone had this issue before? Any help would be appreciated. DaveDave SQL Developer
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend