SSIS Package Runs OK Manually But Not From SQL Server Agent...Permissions?

I have a problem where I have an SSIS package (SQL Server 2005) that won't run properly from SQL Server Agent, but it runs fine when kicked off manually from Integration Services -> Run Package or when run in debug from Visual Studio.
The first step in the package checks for the existance of a file via a script task.  The script looks like this...
Code Block
Public Sub Main()
Dim TaskResult As Integer
Dim ImportFile As String = CStr(Dts.Variables("BaseDirectory").Value) + CStr(Dts.Variables("ImportDirectory").Value) + CStr(Dts.Variables("ImportFile").Value)
If Dir(ImportFile) = "" Then
Dts.TaskResult = Dts.Results.Failure
Else
Dts.TaskResult = Dts.Results.Success
End If
Return
End Sub
This script runs fine and the file is seen as expected when I run the package manually.  But as a step in a SQL Server Agent job, it doesn't see the file.
The SQL Server Agent service is set to start up / log on as a Local System Account.  I've also tried setting up a credential / proxy (using an account that I know can see and even move / rename the file) to run the job as but that didn't seem to help.
The package is being run from SQL Server (stored in MSDB) and is set to rely on SQL Server for sensitive information, so I don't think that's an issue; other packages are set up like this in terms of sensitive data and run fine.
Any ideas why my script can't "see" the file I'm looking at when it's kicked off by SQL Server agent?  I've looked and looked...I can't seem to figure this out.  I would really appreciate any help you might be able to offer up.

If the variables are fine, then I think it is very likely that this is security related. Since the Agent is running under the local system account, have you verified that the local account can access the file? When you tried the proxy account, are you positive that it was set up properly, and that the account had the permissions to read the file?
Another thing to check - is this a local file or is on another computer? If it is on another computer, make sure you are using a UNC path and not a mapped drive.

Similar Messages

  • VBScript Runs Correctly From Command Prompt, But Not From SQL Server Agent Job

    I'm trying to run this script on my local machine to do some post-batch cleanup and it doesn't run correctly from the scheduled job (or when I invoke the job).
    Here's the script in question:
    Option Explicit
    Const filePath = "C:\Documents and Settings\jmunn\My Documents\Visual Studio 2008\Logs\"
    Const holdDays = 6
    main
    Sub Main()
    ClearArchive
    End Sub
    Sub ClearArchive()
    Dim fso 'As Scripting.FileSystemObject
    Dim fld 'As Scripting.Folder
    Dim f 'As Scripting.File
    Dim delLogName, delLogOut, delCtr
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fld = fso.GetFolder(filePath)
    delLogName = filePath & "Nightly Backup - Backup Logs Deleted" & ".txt"
    Set delLogOut = fso.CreateTextFile(delLogName, True)
    delLogOut.WriteLine(delLogName)
    delLogOut.WriteLine("")
    delLogOut.WriteLine("-- The following log files were deleted on " & DateValue(Now()) & " at " & TimeValue(Now()))
    delLogOut.WriteLine("")
    delCtr = 0
    For Each f In fld.Files
    If Left(f.Name, 48) = "Nightly Backup - SQL Server Databases_Subplan_1_" And Right(LCase(f.Name), 4) = ".txt" Then
    If DateDiff("d", f.DateCreated, Date()) > holdDays Then
    delLogOut.WriteLine(f.Name)
    fso.DeleteFile f, True
    delCtr = delCtr + 1
    End If
    End If
    Next
    If delCtr = 0 Then
    delLogOut.WriteLine("No log files were deleted this run...")
    End If
    Set fld = Nothing
    Set fso = Nothing
    delLogOut.Close
    End Sub
    If I put the script in its own file and run it from the command prompt, it runs just fine. If the script runs from the SQL Server Agent job, the for-loop will delete the files correctly, but the filenames
    do not get written to the deletion log file and the counter does not get incremented, so according to the job log, nothing was deleted. Why does the script run differently from each invocation? It can't be a permission thing, the service that logs in has full
    access to the directory and the files do get deleted. Any ideas out there?
    Between this and other outstanding issues, I'm quickly losing faith in SQL Server.  >=o(
    Thanks in advance for your thoughts!
    John
    Version Info:
    Microsoft SQL Server Management Studio      10.0.2531.0
    Microsoft Analysis Services Client Tools      10.0.1600.22
    Microsoft Data Access Components (MDAC)      3.85.1132
    Microsoft MSXML      2.6 3.0 4.0 5.0 6.0
    Microsoft Internet Explorer      8.0.6001.18702
    Microsoft .NET Framework      2.0.50727.3603
    Operating System      5.1.2600
    "A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation..."

    Hi
    jrmunn
    i am trying to execute VB script to refresh my excel files.. using Vbscript file through SQL Agent job step.
    i have copied VBscript in a file with the extension RefreshExcel.vbs kept in C:\RefreshExcel.vbs
    Below is the script used inside the file (RefreshExcel.vbs)
    //---Script code-----------------------------------------------------------------
    Dim objXL, objWB
    Dim FileLocation, FileName
    On Error Resume Next
    'lgnConn = 1
    FileLocation = "F:\Reports\Reports"
    Set objXL = CreateObject("Excel.Application")
    objXL.DisplayAlerts = False
    FileName = "ReportFile1.xlsx"
    'MsgBox (FileLocation & "/" & FileName)
    Set objWB = objXL.Workbooks.Open(FileLocation & "/" & FileName)
    objWB.EnableConnections
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.Save
    objWB.Close
    Set objWS = Nothing
    Set objWB = Nothing
    objXL.Quit
    Set objXL = Nothing
    'MsgBox ("Refresh Completed")
    ---------------------------------------------------------------------------------------------------//Script complete
    Now when i am trying to call this script file in SQL agent job step (as you mentioned )
    as Type -cmdExec(OperatingSystem)
    cscript "C:\RefreshExcel.vbs"
    Issue: job step executed succesfully ,,but without performing any refresh on the excel. So i am not understandig what is going wrong. the same script file work when i am calling it through a batch file (window scheuler task). But it doesnt support
    to run the file "when user is not logged in"
    that is why  i want to refresh my excel file through sql agent ,which can be scheduled to any time and cab be run as SQL agent credentials.
    Can you please help me on this ...i have tried all the option but nothing working .. found hope by seeing your solution.
    Thanks in advance.
    Please help me. :-(

  • SSIS package give an error if execute through SQL server agent

    I have created a SSIS package in BIDS 2012. If i execute this package through sql server agent it gives the below error:
    Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  11:19:47 AM  Error: 2015-01-20
    11:19:47.83     Code: 0xC0016016     Source: Sub_Hadoop_aggregation      Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.".
    You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-01-20 11:19:47.94     Code: 0xC0016016     Source:
    Sub_Hadoop_aggregation      Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error
    occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2015-01-20 11:19:48.04     Code: 0xC0016016     Source: Sub_Hadoop_aggregation      Description: Failed to
    decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct
    key is available.  End Error  Error: 2015-01-20 11:19:48.92     Code: 0xC00291EC     Source: alter_keys Execute SQL Task     Description: Failed to acquire connection "mstr_warehouse". Connection may not be
    configured correctly or you may not have the right permissions on this connection.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  11:19:47 AM  Finished: 11:19:48 AM  Elapsed:  1.42 seconds.
     The package execution failed.  The step failed.
    so i have change some properties in our package like protectionlevel change from encrypted to dontsavesensitive. After that i have created configuration file for the package and use that configuration file. It executes the package through sql server agent
    smoothly.
    Thanks
    Azhar Khan

    Hi selfdestruct80,
    According to your description, you created SSIS package and it works fine. But you got the error message when the SSIS package was called from a SQL Server Agent job.
    According to my knowledge, the package may not run in the following scenarios:
    The current user cannot decrypt secrets from the package.
    A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
    File access fails because the current user does not have the required permissions to write to the file share that the connection manager accesses.
    A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys are user-specific.
    A task or a connection manager requires that the current user account has correct permissions.
    According to the error message, the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword as ArthurZ mentioned. To solve the problem, you need to go to Command Line tab, manually specify the paassword in SQL Agent Job with the command like below:
    /FILE "\"C:\Users\xxxx\Documents\SQL Server Management Studio\SSIS\Package.dtsx\"" /DECRYPT somepassword /CHECKPOINTING OFF /REPORTING E
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Error While executing a SSIS package which contains a script task through SQL Server Agent job

    Hi,
    I have a SQL Server 2012 SSIS package with a script task along with other tasks [data flow, execute sql tasks ]. When I manually executed the job through BIDS, its completed successfully. 
    Then I have automated the execution of the package through SQL Server Agent Job. But when I executed the package through SQL Agent job, it runs successfully for all the tasks except script task. When it comes to execute the Script Task, it is getting failed
    with the below error message.
    "Error: 2012-08-29 12:45:14.67
       Code: 0x00000001
       Source: Script Task 
       Description: Exception has been thrown by the target of an invocation.
    End Error
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  12:45:10 PM
    Finished: 12:45:14 PM
    Elapsed:  4.353 seconds
    I have installed the SSIS on the 64-bit environment and SSIS service is running. Also I tried to run the job through 32 bit [job option] but I am getting the above error in all cases.
    Any help will be greatly appreaciated !
    Thanks,
    Navin
    - naveen.reddy

    Hi Arthur,
    My script task access the excel files in a network share, refresh them all and save them. When I execute the ETL manually or thru DTEXEC, it is executing successfully. I am facing the issue when I am executing thru SQL Agent Job only. Logging also showing
    the same error.
    "Error: 2012-08-23 12:45:14.67
       Code: 0x00000001
       Source: Script Task 
       Description: Exception has been thrown by the target of an invocation.
    End Error
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  12:45:10 PM
    Finished: 12:45:14 PM
    Elapsed:  4.353 seconds
    - naveen.reddy

  • Want to delete mails from Thunderbird but not from the server?

    Hi,
    Please tell me how to configure the settings of Thunderbird so that if i delete any mail from Thunderbird that mail would be delete only from Thunderbird not from server. I'm using IMAP configuration for all my mail accounts and I'm using Thunderbird in my laptop and tablet both.
    Currently i'm using Thunderbird 24.4.0 and i just want to delete my useless mails from Thunderbird but not from the server without using pop-3 settings.
    Actually the reason for this Question arises because whenever i use to uninstall and reinstatement Thunderbird, i use to take "profiles" as a back up and its size is increasing day by day that is making a big issue to me as i cant take a back up of such a big size file.

    Imap mail accounts keep the emails on the server and you see a remote view of those emails and folders.
    When you subscribe to see a folder, the headers are downloaded, when you select an email to read, the entire folder is downloaded to a temp cache facilitating quicker access. If you synchronize folders, then a copy of that folder is downloaded to an mbox file in your profile, so that you have a copy of the server folder. When you make any changes to a synchronized folder, read an email, delete or move etc, then Thunderbird will resynchronize with the server to update the server. A synchronized folder allows you to work in 'offline' mode and this is the best time to perform a backup as you know there is a temporary stop on synchronizing as you are offline. They will resynchronize when you go back into 'online' mode.
    So, with IMAP mail accounts, the folders you see in Thunderbird are the same folders on the webmail server. If you make any changes via Thunderbird or webmail then you are changing the same folder. You cannot delete an email without deleting it from the server, they are one and the same.
    What you can do is move/copy an email into Local Folders and delete the one on the server. The Local Folders emails are kept in your Profile on your computer, these folders/emails are not on the server, unless you chose to keep a copy of them on the server.
    Pop mail accounts cannot see the folders on the server. They only access the server Inbox folder and download emails not previously downloaded to the mail account Inbox in Thunderbird. These emails are kept on your computer in your profile folder. You can select to keep a copy on the server or not. You can choose to delete emails off your computer and off the server or not.
    If the mail account is gmail , have you subscribed or even synchronized to see the 'All Mail' folder ? Gmail's all Mail folder is their Archive folder, it keeps a copy of all of your non-deleted emails. So, you do not need to subscribe to see this folder as it only shows you what you can already see in other folders. It doubles the disc space.
    Please read section on 'All Mail' at this link.
    * http://kb.mozillazine.org/Using_Gmail_with_Thunderbird_and_Mozilla_Suite
    You do not have to download/synchronize the entire folder. You could select to only synchronize the most recent xx days of emails.
    see info here:
    * https://support.mozilla.org/en-US/kb/imap-synchronization#w_configuring-synchronization-and-disk-space-usage

  • Can't launch executable from SQL Server Agent Job

    I'm trying to launch an .exe from SQL Server Agent Job and basically nothing happens. I created a job, with 1 step, type is Operating System (CmdExec), run as sql agent service account, and in the command box I typed "start notepad" (no quotes). The job owner is set to administrator. I manually start the job, it processes successfully yet notepad does not launch. I've tried with other .exe's and result is the same. Any advice? Thanks!

    I tried several things and not just with notepad, I tried a couple other small executables. I've tried:
    c:\notepad       --(I copied it to c:\ thinking it maybe it's not finding the file.)
    c:\notepad.exe
    notepad.exe
    start notepad
    start notepad.exe
    and also launching it from a batch file.
    If I use just notepad the job hangs saying it's executing and I have to stop it. If I use start notepad it comes back as executed but actually nothing happens, ie, notepad does not launch. I've tried different security settings within SQL Server (ie assigning all available default roles to the login at the same time and individually one at a time) with identical results. SQL Server is loging in with local administrator priviledges and so is SQL Server Agent. My settings are the default installation settings (for Windows Server 2003 and SQL Server 2005) except that I read the BOL page "Configuring SQL Server Agent" which indicates the permissions needed for the following:
    Adjust memory quotas for a process
    Act as part of the operating system
    Bypass traverse checking
    Log on as a batch job
    Log on as a service
    Replace a process level token
    And they have been set. Still the same. BTW, I get the same result when trying to launch the file using xp_cmdshell with all the variations, and the proxy account for xp_cmdshell has been set to a login with administrator priviledges....
    I think it's some security setting in Windows Server, if only because I think I've tried all the settings within SQL Server...
    BTW, also, nothing is setup for Proxies under the SQL Server Agent node, but I don't think I should need to if I'm using the administrator level login...

  • Getting an error running an SSIS package from SQL server agent

    This is the first time I'm running an SSIS package in SQL server agent.
    I'm running a SQL server agent job and getting this error message:
    Am I using the correct options? (options list below)
    Message
    Executed as user: SITEX\stxdatasqlexec. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.1600.1 for 32-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  1:42:00 PM  Error: 2014-04-17
    13:42:01.01     Code: 0xC0011007     Source: {B72BF421-785A-44EC-9570-D2A40B046CA7}      Description: Unable to load the package as XML because of package does not have a valid XML format. A
    specific XML parser error will be posted.  End Error  Error: 2014-04-17 13:42:01.02     Code: 0xC0011002     Source: {B72BF421-785A-44EC-9570-D2A40B046CA7}      Description: Failed
    to open package file "C:\Users\halexandrovich\Documents\Nbr_Rolls_base.dtsx" due to error 0x80070003 "The system cannot find the path specified.".  This happens when loading a package and the file cannot be opened or loaded correctly
    into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  End Error  Could not load package "C:\Users\halexandrovich\Documents\Nbr_Rolls_base.dtsx"
    because of error 0xC0011002.  Description: Failed to open package file "C:\Users\halexandrovich\Documents\Nbr_Rolls_base.dtsx" due to error 0x80070003 "The system cannot find the path specified.".  This happens when loading a
    package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  Source:
    {B72BF421-785A-44EC-9570-D2A40B046CA7}  Started:  1:42:00 PM  Finished: 1:42:01 PM  Elapsed:  0.047 seconds.  The package could not be found.  The step failed.
    Here are the options I'm using:
    package source - file system
    data source  destination = my SQL server db
    execution option - use 32 bit runtime
    command line entry:
    - /FILE "C:\Users\halexandrovich\Documents\Nbr_Rolls_base.dtsx"  /CONNECTION DestinationConnectionOLEDB;"\"Data Source=esxdspr-sql01.sitex.com;Initial Catalog=SuesTbls;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=false;\""
    /CONNECTION SourceConnectionFlatFile;"\\sitex.com\dfs\Production\SFTPData\LPSEFTProcess\FromAADFS\Rpt_Nbr_Rollsperbatch_20140331_20_0.txt"
    /X86  /CHECKPOINTING OFF /REPORTING E
    I checked the filename so it must be the XML format it's complaining about.

    Thank you, pituach.
    I tried running the package using just my c drive without partition, C:\Nbr_Rolls.dtsx, but still getting the same
    error. I do not see any option on this site to post my package. I know it's not the path that's the issue. Our support desk already fixed that because I was getting a different message before.
    Message
    Executed as user: SITEX\stxdatasqlexec. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.1600.1 for 32-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  11:23:00 AM  Error: 2014-04-18
    11:23:00.44     Code: 0xC0011007     Source: {2BEE62EB-DD08-4867-9F5C-660167964650}      Description: Unable to load the package as XML because of package does not have a valid XML format. A
    specific XML parser error will be posted.  End Error  Error: 2014-04-18 11:23:00.45     Code: 0xC0011002     Source: {2BEE62EB-DD08-4867-9F5C-660167964650}      Description: Failed
    to open package file "C:\Nbr_Rolls.dtsx" due to error 0x800C0006 "The system cannot locate the object specified.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of
    either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  End Error  Could not load package "C:\Nbr_Rolls.dtsx" because of error 0xC0011002.  Description: Failed
    to open package file "C:\Nbr_Rolls.dtsx" due to error 0x800C0006 "The system cannot locate the object specified.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of
    either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  Source: {2BEE62EB-DD08-4867-9F5C-660167964650}  Started:  11:23:00 AM  Finished: 11:23:00 AM 
    Elapsed:  0.125 seconds.  The package could not be found.  The step failed.

  • SQL Procedure working when run manually, not running from sql server agent

    I have a procedure that runs fine using the execute command in SSMS, however putting the same command in a job gives the following error.
    line 9, character 9, unexpected end of input
    The code takes a very long XML string in UTF-8 encoding and puts it into a single nvarchar(max) cell. Then puts this string into a XML cell in a different table, allowing me to query the individual parts of the XML code using the nodes function. I cannot put
    the data directly into a nvarchar cell due to encoding differences.
    I can't reproduce the string here as it is very very long.
    I'm just looking for ideas really as to where it might be going wrong.
    Here is what I know so far:
    The procedure runs without issue when executed manually
    I have checked permission issues, and that doesn't seem to be the problem. The agent runs under my own account and I am a sysadmin on the database
    I split the procedure into seperate parts to locate exactly where the problem is occuring. Once again the seperate procedures run fine when executed manually but an error occurs when run through SQL Server agent.
    When the query is run seperately through SQL Server Agent it gives a slightly different error. This leads me to believe it is an encoding issue. However I am getting the XML from a webpage and I can't change the encoding on the webpage.
    line 1, character 38, unable to switch the encoding
    I know this is a long shot since you can't replicate the issue but if anyone could give an idea as to where to start looking for an answer, it would be greatly appreciated.

    Here's how I'm taking the XML data and putting it into an nvarchar(max) column (Column Name TEXT):
    Select @url = 'http://....'
    EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OAMethod @win,'Send'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    INSERT #TextData(TEXT)
    EXEC @hr=sp_OAGetProperty @win,'ResponseText'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OADestroy @win
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

  • Error when execute a package from SQL Server Agent

    We have the next problem:
    When we execute a package from a Job of SQL Server agent, it shows the success messege, but reviewing the results, the package didnt do all the tasks.
    When we run it mannually by MSIS the package, it shows the success message and it works fine.
    The workflow of the package is :
    1) Shrink the databases (executing a sql file)
    2) Backup the databases (Back up Database task of MSIS)
    3) Rename the files to .BAK extension (by the Foreach loop container and fyle system task)
    4) Execute command to compress the it (by a .bat)
    5) Move the compress file to another location  (by another Foreach loop)
    Manually run correct, but when is a a SQL AGent Job that execute the package it does only the first 2 steps.
    we are ussing Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (coffee) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) 
    We are using a user with administrator privilegies
    Cheers 

    Can you check if account running package has proper access. You may need to define a proxy account for that.
    See
    http://www.databasejournal.com/features/mssql/article.php/3789881/Proxy-Accounts-in-SQL-Server.htm
    http://gqbi.wordpress.com/2014/01/30/setting-up-a-proxy-account-to-run-sql-server-integration-services-ssis-2012-packages/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • TSQL working in 2008 but not in SQL Server 2014

    Hello,
    We recently have been asked to move from SQL Server 2008 to SQL Server 2014. We are trying to run parallel tests and one of our queries that was working perfectly in 2008 is not working in 2014.
    One of the filter on the our query(from 2008) is we convert a varchar field to date and compare it to anotehr calulated filed ("convert(date,Quick_Data_Start_Date) <= convert(date,(Year_ID_to_Use + '-' + Month_ID_to_Use + '-01'))").
    This worked fine in 2008 but when i try to do similar operation in 2014 it returns no result.
    For testing purposes, instead of converting the field to date format, i manully converted the actual value i.e. instead of using "convert(date,Quick_Data_Start_Date)" when i use "convert(date,'8/1/2014')" the code works fine.
    The field "Quick_Data_Start_Date" comes from a pivot query.
    When i create a temporary table for the pivot query and use the temporary table in  my code and then convert the field on fly the code works fine again.
    Seems like the T sql is not able to convert the field from varchar to date on the fly when coming from a different query. We have tried changing the compatbility level to 100 as well and it still would not work.
    Any suggestions and comments will be really helpful. Thanks.
    Regards,
    GM

    Hello, here is my overall review:
    The query is not optimized … agreed!  But that’s not the issue.
    There are a number of indexes that could be created, a number of minor calculations or evaluation criteria that could be improved to make the query more efficient … again – AGREED.
    The query “as is” runs in just under a minute (on SQL 2008 machine with less memory and slower hard drives).  Adding the indexes would take more time to add than they would save.
    NONE of that should make the query NOT WORK.  These deficiencies might make it run more slowly, but should not cause the query to return no results.
    “order by” shouldn’t make any difference because the query plan isn’t assuming or using any special order
    The main table (~10 M rows) is using a clustered index scan (not efficient, but not the point)
    The Time dimension table is using a non-clustered index seek (so the index is sorted but the data in the table is NOT physically sorted that way)
    The pivot subquery is using clustered index scan (it’s only 6 rows, so who cares)
    Once again, the order by might make it less efficient, but shouldn’t make it fail.  We get no errors or warnings – it just returns no rows.
    Because the query DOES return results when we 
    Either dump the Pivot query result into a #temp table(single row) and use the #temp table instead of the pivot query in the big SQL or  
    The “input” tables are limited to X rows but DOES NOT when the inputs have more rows
            This strongly suggests a memory issue.
    The server has 64 GB of RAM, but this probably isn’t enough to hold millions of rows and calculations.
    Can we turn on some traces to see what’s happening to the data in the query?  How and what are we looking for?
    Once the memory capacity is exceeded, SQL should be pushing these results to a temporary table (either in the local database or the tempdb).  Can we test to see if that is happening? 
    How?
    Is there a permissions issue?
    I have successfully done large copies outside of SQL (copied 300+ GB file from one location to another) that had to use the disk instead of just memory … means the disk write operation
    isn’t restricted from my user account.
    I can also confirm that the account that runs the SQL Service (“Network Service” account) has full permissions to the drives and paths where the mdf and ldf files are stored (including
    master and temp).
    If this doesn’t work, our upgrade is basically frozen and cannot proceed.  I’m really out of ideas … anything?

  • SSIS job runs in designer but fails in SQL Agent - timeout error

    I have several SSIS packages that have been running without issue for well over a year. These jobs were imported into SQL Server and run on a schedule with SQL Agent.
    Over the weekend these jobs failed with the message:
    Description: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.  The statement has been terminated.  Source: .Net SqlClient Data Provider  Started:  8:13:01 AM 
    Finished: 8:13:31 AM  Elapsed:  30.155 seconds.  The package execution failed.  The step failed.
    When I look at the package history it doesn't even show that the job attempted to run over the weekend. As such I assume that the error is related to SQL Agent attempting to connect to the SSIS job.
    As stated in the title, the jobs run without issue in the designer.
    I did stop and restart SQL to see if that would have an effect - sadly it did not.
    I attempted to reload one of the packages. More specifically I re-imported it and allowed it to overwrite the existing project, This step completed ok and moved to the next step - deploy the project. It fails to deploy the project with the following error
    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (.Net SqlClient Data Provider)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2218&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476
    Server Name: XXXXXXX
    Error Number: -2
    Severity: 11
    State: 0
    Program Location:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       at Microsoft.SqlServer.IntegrationServices.Common.ObjectModel.SqlHelper.ExecuteSQLCommand(SqlStoreConnection storeConnection, CommandType cmdType, String cmdText, SqlParameter[] parameters, ExecuteType execType, Int32 commandTimeout)
       at Microsoft.SqlServer.Management.IntegrationServices.CatalogFolder.DeployProject(String projectName, Byte[] projectStream)
       at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeployExportProjectHelper.DeployProject(CatalogFolder folder, Project project)
       at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeploymentModel.Deploy(CatalogFolder folder, Project project)
       at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeploymentModel.DeployProject()
       at Microsoft.SqlServer.IntegrationServices.Deployment.DeployProjectPage.DoWork(Object sender, DoWorkEventArgs e)
       at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
       at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
    ===================================
    The wait operation timed out
    It would seem to me that there is an environmental error, though I know of nothing that has changed. I don't know where to look. If you have seen this behavior before or have an idea, I welcome your input.
    Thanks
    Mike

    Hi Mike,
    Based on the error message, we can infer that the issue is caused by connection or command timeout.
    To work around this issue, we can increase the connection timeout and command timeout, buffer size and create two indexes in the SSISDB catalog to improve the performance. For more details, please see:
    http://capstonebi.blogspot.com/2012/09/ssis-2012-deployment-frustrations.html
    Reference:
    https://connect.microsoft.com/SQLServer/feedback/details/804901/ssis-2012-deploying-new-versions-of-large-projects-runs-into-a-timeout-during-deployment-into-ssis-catalog
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • [Forum FAQ] How to get SSIS packages XML definition which are stored in SQL Server Integration Services instance

    Introduction
    Integration Services gives you the ability to import and export packages, and by doing this change the storage format and location of packages. But after import packages into package store, how can we get the package XML definition?
    Solution
    As we know, SSIS packages are stored in msdb using existing SSIS storage table([msdb].[dbo].[sysssispackages]). The “packagedata” column store the actual SSIS package with Image data type. In order to get the package XML definition, we need to convert “packagedata”
    column through Varbinary to XML. You can refer to the following steps:
    Using the following query to get package GUID:
    SELECT [name],
                [id]
      FROM [msdb].[dbo].[sysssispackages]
    Using the following query to convert packagedata column to XML: SELECT id, CAST(CAST(packagedata AS VARBINARY(MAX)) AS XML) PackageDataXML
    FROM      [msdb].[dbo].[sysssispackages]
    WHERE id= 'ABB264CC-A082-40D6-AEC4-DBF17FA057B2'
    More Information
    sysssispackages (Transact-SQL):
    http://msdn.microsoft.com/en-us/library/ms181582.aspx
    Applies to
    SQL Server 2005
    SQL Server 2008
    SQL Server 2008R2
    SQL Server 2012
    SQL Server 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi Ketak. Thank you for replying. I already followed your instructions - specifically -
    You do not see the SQL Server Reporting Services  service in SharePoint Central Administration after installing SQL Server 2012 SSRS in SharePoint mode
    I get the following error when I run rssharepoint.msi on the APP sever (where Central Admin is installed). I have to run this other wise
    Install-SPRSService and Install-SPRSServiceProxy 
    are not recognized as commands on that server.
    Failed to call GetTypes on assembly Microsoft.AnalysisServices.SPAddin, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. Could not load file or assembly Microsoft.AnalysisServices.SPClient, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
    or one of its dependencies. The system cannot find the file specified.
    macrel

  • Jmxri running under javaw but not from java web start

    Hi all
    I've got following problem.
    I've got application that uses special jar that requires jmxri.jar This jar is black box for me. It provides some interface to get data from server.
    When I run my application using jmxri.jar and mentioned black box (jar) from command line with javaw, it is working fine.
    javaw -Xmx256m -classpath application.jar;jmxri.jar;(blackbox.jar); CClient
    In case I use jnlp, everything is same, I've got following error meassage.
    cia4all:name=Cia4allFactory.... Exception ........................................
    javax.management.InstanceNotFoundException: cia4all:name=Cia4allFactory
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
         at de.siemens.cc.b2b.cia4all.client.Cia4allClientFactory.createLdap(Unknown Source)     
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)Cia4allClientFactory - is class in mentioned black box jar
    The jnlp looks like
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="file:/D:\" href="my.jnlp">
       <security>
          <all-permissions/>
       </security>
       <resources>
          <j2se version="1.4+" max-heap-size="256m"/>
          <jar href="application.jar" main="true" download="eager"/>
          <jar href="blackbox.jar" download="eager"/>
          <jar href="jmxri.jar" download="eager"/>
       </resources>
       <application-desc main-class="CClient">
       </application-desc>
    </jnlp>Any idea what must be configured in jnlp or missing ?
    Edited by: svist001 on Aug 28, 2008 12:56 AM

    The default remote apps webpage will be shown with these demos. In order to remove them for all-users, You need to change the default remote apps url, not in the user configuration file, but in a system config file.
    unfortunately, because of bug 4933851, you can not just put a deployment.properties file in the javaws directory (untill update release 1.4.2_05, where this is fixed). Instead you have to put it in what they call ${deployment.system.home} which on unix is /etc/.java/.deployment, but on windows is ${windows dir}\Application Data\Sun\Java\Deployment
    /Dietz

  • How to delete mail from mac but NOT from gmail server?

    Hi I have around 6GB of space used up by the mail app. I never really use it anymore though, favouring the gmail website. I can't work out how to clear out the mail app and free up that space, without also deleting the emails from the gmail server. Can anybody help?
    Thanks
    Jonathan

    Hello Jhughes1986,
    If you are not using the mail account in the Mail app, then remove it from Mail. When in Mail, go to the drop down menu Mail > Preferences, select the Account tab, select your Gmail account and then hit the Minus ( - ) button towards the bottom to remove the account. 
    Mail (Mavericks): Remove mail accounts
    http://support.apple.com/kb/PH14944
    Regards,
    -Norm G. 

  • SSRS reports running slow while fetching data from SQL server DB

    We are currently facing issues with lots of our SSRS reports running very slow. Approx they are taking around 15-20 minutes compared to earlier which was 2-3 minutes.
    Also, the SSRS reports which fetch their data from a Database is acting as Subscriber for a reporting server. That is we have an OLTP DB server whose Database say 'A' is getting replicated onto the server where say Database 'B'. On this B we have our SSRS
    reports fetching the required data and are reported to be running very slow.
    As a start I have checked for Index and stats to be properly updated and yes they are.
    I am not sure now, from where to start analysing the issue.
    I believe replication, not to be the issue as earlier also we had replication set up and never saw the slowness.
    IS memory or IO causing a problem, please help as i am not sure on how to find a fix for this?
    Thanks in advance!

    Hi,
    You need to first find out what all are slow? Is it that the whole instance is slow? How about other queries /replication etc against those databases? Are they slow?
    Check the reports which are slow, try to find the slowest reports and then start looking at execution plans. Check if there is any kind of blocking happening during the time the reports run. Also try running the reports manually and see if there is a difference
    in execution time. Take a look at the waitstats during the time the reports are running.
    Read this to get more better understanding -
    https://technet.microsoft.com/en-us/library/ms177500%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

Maybe you are looking for

  • Ora -06502 from forms application

    I have medical application developed by forms 9i, But its responds error ORA-06502 while running a form with enter query mode. it displys the said error while execute the query . I dont the exeact SQL query returns this error. How to debug this? Is t

  • C4599 HP Printer printing problem

    I wanted to print a 40 pages manual but when i pressed the print button, the printer started printing from the last page(40) to the first page(1). When I looked at the printer's properties in the word document, my "Layout Options" for "Page Order" is

  • When I try to view the pictures full size it won't go from picture to picture then it locks up.

    My iphoto keeps locking up.  When I view pictures and double click on them to see them larger it just freezes up and I can't do anything else.  I have to quit iPhoto altogether and start over.

  • Open with External Editor Adobe Camera Raw = HOW?

    When I export a RAW file to the External Editor (I've chosen Photoshop CS3) I would like for it to open in Adobe Camera Raw, just like any RAW file that I open in Photoshop outside of Aperture. However it bypasses Adobe Camera Raw and opens directly

  • Full screen - view zoom - no auto turn to next page ?

    Hi I have an interactive pdf with a full screen button nested into a master layout. Whenever the pdf is in full screen mode, when I click anywhere the pdf turns to the next page! How can I keep the full screen mode but delete the 'goto next page' act