Showing posts with label procedure. Show all posts
Showing posts with label procedure. Show all posts

Friday, March 30, 2012

One for the record books

I'm inside EM. I click on a database, then the Stored Procedure list.
Everything's . When I try to scroll down I get a Message Box:
System Error [x]
The memory manager has failed.
[OK] [Cancel]
Obviously, I rebooted, but what the heck would have happened if I hit
[Cancel] ?!?
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James HetfieldApparently the memory manager would no longer have failed :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:OSjUAZKtFHA.2008@.TK2MSFTNGP10.phx.gbl...
> I'm inside EM. I click on a database, then the Stored Procedure list.
> Everything's . When I try to scroll down I get a Message Box:
> System Error [x]
> The memory manager has failed.
> [OK] [Cancel]
> Obviously, I rebooted, but what the heck would have happened if I hit
> [Cancel] ?!?
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "Musha ring dum a doo dum a da!" -- James Hetfield
>|||>> System Error [x]
> Apparently the memory manager would no longer have failed :)
Just try telling that to the memory manager.
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James Hetfield|||"We can't fix the actual problem right now, but we're giving you three ways
to close this window."
ML

Wednesday, March 28, 2012

One column missing from datasets even after refresh?

My report's data source is a stored procedure which takes 4 parameters. If I execute the sp from the data tab it returns the correct data and columns; but if I right click the Report Datasets from the Datasets view and click on refresh I'm always missing one column. Is this related to the way the sp was written? Anybody had same expericence before? Thanks!

I have.

One thing you can do is check for a matching .rdl.data file and blow that away, see if next data pull rewrites the cached data.

Another thing you can probably do is just add it in manually. Rightclick on the *name* of the dataset (underneath the Report DataSets node in the Datasets window) and choose "Add..."

>L<

|||

Thanks for the help! The first method doesn't work. Even if I add a new report from scratch, the available fields are missing that column if I put the sp in the query builder from report build wizard.

Rightclick on the name of the dataset and add the missing column works, but after I deploy the report and go view the report from brower, I got the following message:

An error has occurred during report processing.

  • Query execution failed for data set 'RegionalLevelByWeek'.

  • For more information about this error navigate to the report server on the local server machine, or enable remote errors
  • |||Hmm. I think the first method doesn't work if you have a (usually generated) schema file associated

    with the data -- I'm not looking at reports right now, so I could be wrong) -- you might have to "refresh" that file as well.

    On the second one, do you have to re-deploy the datasource to the server or something? (remember it's "don't overwrite datasources during deploy" by default) Same is true with default values of params -- given your situation as you put it in this message, that might well be involved.

    Now that I look at what you're saying here though... As far as your current thing with the two SP's, you could just put a dummy column into the first result set, couldn't you? The important thing to remember is that there is going to be *one* set of columns associated with that report, never two, so if your proc can return differently based on a param you pretty much have to make them match.

    I'm sorry I can't do a worked example right now, it's always *something* find-able though...

    >L<

    sql
  • Monday, March 26, 2012

    on EXEC a sp

    Please provide more information for others to better understand you problem.
    Do you want to send the email when the procedure returns certain result? How
    often is the procedure being run? Where exactly is the information regarding
    sending the email?
    AnithAnith,
    Yes, I would like the sp to send an email when the results = TIME. The sp
    can be executed using the Agent Job and should be executed daily at 00:01.
    Thank you.
    "Anith Sen" <anith@.bizdatasolutions.com> escribi en el mensaje
    news:edX7krOWGHA.4652@.TK2MSFTNGP04.phx.gbl...
    > Please provide more information for others to better understand you
    > problem. Do you want to send the email when the procedure returns certain
    > result? How often is the procedure being run? Where exactly is the
    > information regarding sending the email?
    > --
    > Anith
    >

    Friday, March 23, 2012

    OMG: an Oracle Question :)

    Hello...

    I have a small Oracle question... *ducks*

    In SQL-Server I can return more then one resultset in a single stored Procedure (Get Parents and all child Objects for that/those parent(s))... Is the same possible in Oracle? I think I remember that Oracle cant do that due to the different handling of Selects in SPs?

    Thats it...

    Also I want to know if there is a reverse Copy of the Book ""SQL Server 2000 for the Oracle DBA"

    Oracle allows you to return one or more results via REF CURSOR parameters from functions/procedures. These are more powerful than just returning results. For example, you can pass REF CURSOR parameter from one procedure to another.

    Wednesday, March 21, 2012

    Oledb stored procedure rowset binding

    I have a strange problem with an OleDB call to a stored procedure that
    returns a rowset.
    Only the first time I execute the query, after I restart SqlServer, my
    program crashes because
    the rowset is empty. All next calls (after restarting my program, of
    course) run successfully.

    The context is:
    1) if I do not bind the output rowset, my program doesn't crash
    2) If I run the call without the binding and then I run the call with
    the binding, it doesn't crash
    3) It is not the first query I do in my session
    4) the call crashes only if in the SP there are some inserts: it is a
    well known problem with OleDB, but in many
    other cases I have fixed it setting NOCOUNT to ONgigi (gigisoave@.libero.it) writes:
    > I have a strange problem with an OleDB call to a stored procedure that
    > returns a rowset.
    > Only the first time I execute the query, after I restart SqlServer, my
    > program crashes because
    > the rowset is empty. All next calls (after restarting my program, of
    > course) run successfully.
    > The context is:
    > 1) if I do not bind the output rowset, my program doesn't crash
    > 2) If I run the call without the binding and then I run the call with
    > the binding, it doesn't crash
    > 3) It is not the first query I do in my session
    > 4) the call crashes only if in the SP there are some inserts: it is a
    > well known problem with OleDB, but in many
    > other cases I have fixed it setting NOCOUNT to ON

    Since you don't post any code, it is very difficult to tell. Then again,
    even if you had, it would probably still have been difficult to tell.

    First, exactly what API are you using? The OLE DB API itself? OLE DB
    consumer templates? Something else? Which language do you use?

    Next, let me try to see if I understand the scenario:

    1) You start your machine.
    2) SQL Server starts.
    3) You start your application.
    4) It runs some queries, and then it comes to this procedure that does
    not return a rowset.
    5) Your program crashes.
    6) You restart your application, and now everything works fine.

    Here I assumed that SQL Server ran locally. What happens if you have
    SQL Server on a remote machine? Does the app still crash on first
    access of SQL Server restart? What if you reboot the client machine
    and run again?

    Finally, while the start and stop of SQL Server could have something
    to do with it, it could also be as trivial as buffer overrun, assuming
    that you are programming in C++.

    --
    Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

    Books Online for SQL Server SP3 at
    http://www.microsoft.com/sql/techin.../2000/books.asp|||I can answer all your questions:

    1) If I connect to a remote sqlserver the situation remains the same
    2) I use AOleDB consuner template from VisualC++, but I know the
    problem is in call to ICommand::Execute at oledb level.
    3) when I restrat the server, the connection and the application are
    closed.
    4) Your scenario description is good.
    Bye and thank you

    > Since you don't post any code, it is very difficult to tell. Then again,
    > even if you had, it would probably still have been difficult to tell.
    > First, exactly what API are you using? The OLE DB API itself? OLE DB
    > consumer templates? Something else? Which language do you use?
    > Next, let me try to see if I understand the scenario:
    > 1) You start your machine.
    > 2) SQL Server starts.
    > 3) You start your application.
    > 4) It runs some queries, and then it comes to this procedure that does
    > not return a rowset.
    > 5) Your program crashes.
    > 6) You restart your application, and now everything works fine.
    > Here I assumed that SQL Server ran locally. What happens if you have
    > SQL Server on a remote machine? Does the app still crash on first
    > access of SQL Server restart? What if you reboot the client machine
    > and run again?
    > Finally, while the start and stop of SQL Server could have something
    > to do with it, it could also be as trivial as buffer overrun, assuming
    > that you are programming in C++.

    Friday, March 9, 2012

    ole db transformation - redirect rows problem

    Hi, i have a OLE DB transformation that executes a stored procedure. The stored procedure RAISERROR when an error is caught. I have set the OLE DB transformation to redirect rows. But instead, the task turns red and fails. Did i do something wrong here ?Did you set the error output to redirect rows, or is it still set to the default of failing the component?|||Of course, if the source stored proc is failing, what rows will you be diverting?|||

    ah... i compared Lookup transform and OLE DB transform. For lookup transform, you can control "ErrorRowDisposition" for both Command Input and Command Output....

    But for OLE DB Transform, you can control "ErrorRowDisposition" for only input, not output !!

    So i guess I cannot RAISERROR in the stored proc and let OLE DB transform separate the "bad" records from the "good" records.

    Perhaps I need to modify the stored proc to catch all errors - and return an errorCode parameter as output ? And then check this output parameter to see what records are not processed correctly ?

    please advice !

    Wednesday, March 7, 2012

    OLE DB Provider

    How do you set up an OLE DB Provider on a client machine.
    Is there a similar setup procedure as ODBC?
    Thanks,
    StephIf you have MDAC installed on your client PC, you will have all major OLE DB
    providers. MDAC gets installed along with some applications. You can also
    get it from Microsoft site at: http://www.microsoft.com/data
    HTH,
    Vyas, MVP (SQL Server)
    http://vyaskn.tripod.com/
    What hardware is your SQL Server running on?
    http://vyaskn.tripod.com/poll.htm
    "steph" <stephaniebeling@.hotmail.com> wrote in message
    news:393a01c3559d$91c59f60$a001280a@.phx.gbl...
    How do you set up an OLE DB Provider on a client machine.
    Is there a similar setup procedure as ODBC?
    Thanks,
    Steph

    OLE DB error - Please Help

    OLE DB error
    I have the following sp running one a night via an agent: (See error below)
    CREATE PROCEDURE [dbo].[IDR_Get_IDR] AS
    Declare @.LastRefresh DateTime,
    @.ProcessID Int,
    @.MyError int
    Begin Tran Process_Up
    -- Find the last refreshed process
    Select @.LastRefresh = P_EndTime
    From dbo.IDR_Process
    Where P_Status ='S'
    -- Record the start of the refresh process
    Select @.ProcessID = Max(P_Id)+1
    From dbo.IDR_Process
    Insert Into dbo.IDR_Process(
    P_Id,P_ProcessID,P_StartTime,P_Status)
    Select @.ProcessID ,57,GetDate(),'S'
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Rollback Tran Process_Up
    ELSE
    BEGIN
    commit Tran Process_Up
    Set @.MyError =0
    End
    Begin Tran Pop_Idr WITH MARK
    Truncate Table dbo.IDR_IncomeDist
    Insert Into dbo.IDR_IncomeDist(
    id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertySta
    te,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmou
    nt,
    ApplicationCommitmentFeeAmount,DiscountP
    ointsAmount,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, CommissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified)
    SELECT id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertySta
    te,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmou
    nt,
    ApplicationCommitmentFeeAmount,DiscountP
    ointsAmount,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, commissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified
    FROM OPENQUERY(Digex, 'SELECT * from FileArchive.dbo.IncomeDist')
    Where Created >@.LastRefresh-1 or Modified >@.LastRefresh-1
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Begin
    Rollback Tran Pop_Idr
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'F'
    End
    ELSE
    Begin
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'S'
    commit Tran Pop_Idr
    End
    GO
    When pull out the individual pieces the query and run them in sequence they
    al run fine but when I run the sp as a whole I get the following error:
    Server: Msg 7391, Level 16, State 1, Procedure IDR_Get_IDR, Line 35
    The operation could not be performed because the OLE DB provider 'SQLOLEDB'
    was unable to begin a distributed transaction.
    [OLE/DB provider returned message: New transaction cannot enlist in the
    specified transaction coordinator. ]
    OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
    ITransactionJoin::JoinTransaction returned 0x8004d00a].
    Gerald Blackwell
    gblackwell@.alliedhomenet.comI cannot give you the exact reason for the error but here are sme things to
    check:
    Since there is a linked server and a BEGIN TRAN statement a distributed
    transaction is used. This requires that MSDTC be running on both machine
    and SQL Server has to have access to it. Check the SQL Server errorlog for
    a message related to MSDTC or the transaction coordinator. Also if these
    servers are on Windows 3003 verify that you have Network MSDTc installed.
    It is a Windows component so you can check in Control Panel - Add/Remove
    Programs.
    Rand
    This posting is provided "as is" with no warranties and confers no rights.

    OLE DB error - Please Help

    OLE DB error
    I have the following sp running one a night via an agent: (See error below)
    CREATE PROCEDURE [dbo].[IDR_Get_IDR] AS
    Declare @.LastRefresh DateTime,
    @.ProcessID Int,
    @.MyError int
    Begin Tran Process_Up
    -- Find the last refreshed process
    Select @.LastRefresh = P_EndTime
    From dbo.IDR_Process
    Where P_Status ='S'
    -- Record the start of the refresh process
    Select @.ProcessID = Max(P_Id)+1
    From dbo.IDR_Process
    Insert Into dbo.IDR_Process(
    P_Id,P_ProcessID,P_StartTime,P_Status)
    Select @.ProcessID ,57,GetDate(),'S'
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Rollback Tran Process_Up
    ELSE
    BEGIN
    commit Tran Process_Up
    Set @.MyError =0
    End
    Begin Tran Pop_Idr WITH MARK
    Truncate Table dbo.IDR_IncomeDist
    Insert Into dbo.IDR_IncomeDist(
    id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertyState,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmount,
    ApplicationCommitmentFeeAmount,DiscountPointsAmoun t,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, CommissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified)
    SELECT id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertyState,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmount,
    ApplicationCommitmentFeeAmount,DiscountPointsAmoun t,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, commissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified
    FROM OPENQUERY(Digex, 'SELECT * from FileArchive.dbo.IncomeDist')
    Where Created >@.LastRefresh-1 or Modified >@.LastRefresh-1
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Begin
    Rollback Tran Pop_Idr
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'F'
    End
    ELSE
    Begin
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'S'
    commit Tran Pop_Idr
    End
    GO
    When pull out the individual pieces the query and run them in sequence they
    al run fine but when I run the sp as a whole I get the following error:
    Server: Msg 7391, Level 16, State 1, Procedure IDR_Get_IDR, Line 35
    The operation could not be performed because the OLE DB provider 'SQLOLEDB'
    was unable to begin a distributed transaction.
    [OLE/DB provider returned message: New transaction cannot enlist in the
    specified transaction coordinator. ]
    OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
    ITransactionJoin::JoinTransaction returned 0x8004d00a].
    Gerald Blackwell
    gblackwell@.alliedhomenet.com
    I cannot give you the exact reason for the error but here are sme things to
    check:
    Since there is a linked server and a BEGIN TRAN statement a distributed
    transaction is used. This requires that MSDTC be running on both machine
    and SQL Server has to have access to it. Check the SQL Server errorlog for
    a message related to MSDTC or the transaction coordinator. Also if these
    servers are on Windows 3003 verify that you have Network MSDTc installed.
    It is a Windows component so you can check in Control Panel - Add/Remove
    Programs.
    Rand
    This posting is provided "as is" with no warranties and confers no rights.

    OLE DB error - Please Help

    OLE DB error
    I have the following sp running one a night via an agent: (See error below)
    CREATE PROCEDURE [dbo].[IDR_Get_IDR] AS
    Declare @.LastRefresh DateTime,
    @.ProcessID Int,
    @.MyError int
    Begin Tran Process_Up
    -- Find the last refreshed process
    Select @.LastRefresh = P_EndTime
    From dbo.IDR_Process
    Where P_Status ='S'
    -- Record the start of the refresh process
    Select @.ProcessID = Max(P_Id)+1
    From dbo.IDR_Process
    Insert Into dbo.IDR_Process(
    P_Id,P_ProcessID,P_StartTime,P_Status)
    Select @.ProcessID ,57,GetDate(),'S'
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Rollback Tran Process_Up
    ELSE
    BEGIN
    commit Tran Process_Up
    Set @.MyError =0
    End
    Begin Tran Pop_Idr WITH MARK
    Truncate Table dbo.IDR_IncomeDist
    Insert Into dbo.IDR_IncomeDist(
    id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertyState,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmount,
    ApplicationCommitmentFeeAmount,DiscountPointsAmount,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, CommissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified)
    SELECT id, DateSubmitted, DateSent,SubmittedBy ,
    Branch,TransferToBranch,TransferAmount,
    AssignedToBranch, BranchEmail,BranchPhone,
    BranchFax, LoanNumber, BlockF,LoanAmount,
    DateClosed, Lender, Investor, Appraiser ,
    AppraiserLicense, LoanPurpose, LoanProgram ,
    LoanType, ARMType, OtherProgramType, ExperionScore,
    TransUnionScore, EquifaxScore,BrwFirstName,
    BrwLastName, BrwSS,BrwAddress,BrwCity,BrwState,
    BrwZIP, PropertyAddress,PropertyCity,PropertyState,
    PropertyZip,TitleOrAttorney, TitleOfficer,
    TitleCompany, TitleCompanyPhone, TitleCompanyAddress,
    TitleCompanyCity, TitleCompanyState, TitleCompanyZIP,
    OriginationFeeAmount,UnderwritingFeeAmount,
    ApplicationCommitmentFeeAmount,DiscountPointsAmount,
    YieldPremiumAmount, ProcessingFeeAmount, CourierAmount,
    AppraisalFeeAmount, CreditReportAmount, InspectionFeeAmount,
    FloodCertAmount, AutomatedUWAmount, LenderPaidFeeAmount,
    AssignedToBranchAmount, NRCFeeAmount, InterestPaidAmount,
    GrandTotal, ReserveForMarketing, commissionsPaid,
    CommissionTotal, CommissionRecipient01, CommissionRecipient02,
    CommissionRecipient03, CommissionRecipient04, CommissionRecipient05,
    CommissionRecipient06, CommissionRecipient07, CommissionRecipient08,
    CommissionRecipient09, CommissionRecipient10, Commission01Amount,
    Commission02Amount, Commission03Amount, Commission04Amount,
    Commission05Amount,Commission06Amount, Commission07Amount,
    Commission08Amount, Commission09Amount, Commission10Amount,
    Check01Number, Check02Number, Check03Number,
    Check04Number, Check05Number, Check06Number,
    Check07Number, Check08Number, Check09Number,
    Check10Number, Check01Amount, Check02Amount,
    Check03Amount, Check04Amount, Check05Amount,
    Check06Amount, Check07Amount, Check08Amount,
    Check09Amount, Check10Amount, ChecksTotal ,
    Created,Modified
    FROM OPENQUERY(Digex, 'SELECT * from FileArchive.dbo.IncomeDist')
    Where Created >@.LastRefresh-1 or Modified >@.LastRefresh-1
    Set @.MyError = @.@.Error
    IF @.MyError <> 0
    Begin
    Rollback Tran Pop_Idr
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'F'
    End
    ELSE
    Begin
    Update dbo.IDR_Process
    Set P_EndTime = GetDate(),
    P_Status = 'S'
    commit Tran Pop_Idr
    End
    GO
    When pull out the individual pieces the query and run them in sequence they
    al run fine but when I run the sp as a whole I get the following error:
    Server: Msg 7391, Level 16, State 1, Procedure IDR_Get_IDR, Line 35
    The operation could not be performed because the OLE DB provider 'SQLOLEDB'
    was unable to begin a distributed transaction.
    [OLE/DB provider returned message: New transaction cannot enlist in the
    specified transaction coordinator. ]
    OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
    ITransactionJoin::JoinTransaction returned 0x8004d00a].
    Gerald Blackwell
    gblackwell@.alliedhomenet.comI cannot give you the exact reason for the error but here are sme things to
    check:
    Since there is a linked server and a BEGIN TRAN statement a distributed
    transaction is used. This requires that MSDTC be running on both machine
    and SQL Server has to have access to it. Check the SQL Server errorlog for
    a message related to MSDTC or the transaction coordinator. Also if these
    servers are on Windows 3003 verify that you have Network MSDTc installed.
    It is a Windows component so you can check in Control Panel - Add/Remove
    Programs.
    Rand
    This posting is provided "as is" with no warranties and confers no rights.

    OLE DB error

    I have a stored procedure that consists 4 set of statements (delete rows and
    then insert rows from excel files with openrowset). It returns error when
    execute the 4th insert statement. The error message is:
    OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
    [OLE/DB provider returned message: The Microsoft Jet database engine cannot
    open the file ''. It is already opened exclusively by another user, or you
    need permission to view its data.]
    OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
    IDBInitialize::Initialize returned 0x80004005: ].
    Its strange, I think, that there is no file in the error message... BTW,
    the stored procedure can be executed successfully if any one insert
    statement is commented. Does openrowset or MS Jet database engine has any
    limitation? Could anyone please tell me how can I solve this issue?
    Any help would be appreciated.
    P.S. I'm running SQL Server 2000
    SChi Squirrel,
    Could you please be so kind to post the aforementioned stored procedure here
    ?
    "Squirrel" wrote:

    > I have a stored procedure that consists 4 set of statements (delete rows a
    nd
    > then insert rows from excel files with openrowset). It returns error when
    > execute the 4th insert statement. The error message is:
    >
    > OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
    > [OLE/DB provider returned message: The Microsoft Jet database engine canno
    t
    > open the file ''. It is already opened exclusively by another user, or yo
    u
    > need permission to view its data.]
    > OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0'
    > IDBInitialize::Initialize returned 0x80004005: ].
    >
    > It?|s strange, I think, that there is no file in the error message... B
    TW,
    > the stored procedure can be executed successfully if any one insert
    > statement is commented. Does openrowset or MS Jet database engine has any
    > limitation? Could anyone please tell me how can I solve this issue?
    >
    > Any help would be appreciated.
    >
    > P.S. I'm running SQL Server 2000
    >
    > SC
    >
    >|||here. thanks.
    CREATE PROCEDURE convert_data
    @.userid varchar(8)
    as
    BEGIN TRANSACTION UpdateAll
    DELETE table1
    INSERT INTO table1
    SELECT id, name, cat, getdate(), @.userid
    FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; HDR=YES;
    IMEX=1;Database=d:\data\table1.xls', 'select * from [sheet1$]')
    DELETE table2
    INSERT INTO table2
    SELECT id, serial, add_1, add_2, add_3, getdate(), @.userid
    FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; HDR=YES;
    IMEX=1;Database=d:\data\table2.xls', 'select * from [sheet1$]')
    DELETE table3
    INSERT INTO table3
    SELECT table1_id, table2_id, serial, type, amount, getdate(), @.userid
    FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; HDR=YES;
    IMEX=1;Database=d:\data\table3.xls', 'select * from [sheet1$]')
    DELETE table4
    INSERT INTO table4
    SELECT code, num, description, getdate(), @.userid
    FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0; HDR=YES;
    IMEX=1;Database=d:\data\table4.xls', 'select * from [sheet1$]')
    COMMIT TRANSACTION UpdateAll
    GO
    "Enric" <Enric@.discussions.microsoft.com> wrote in message
    news:EC55EB71-31E0-4A15-8BAA-5A04C45E0640@.microsoft.com...
    > hi Squirrel,
    > Could you please be so kind to post the aforementioned stored procedure
    > here?
    > "Squirrel" wrote:
    >

    Saturday, February 25, 2012

    OLE DB DataSource w\ stored procedure not populating column metadata

    I'm having some issues getting OLE DB Data Sources to work w\ stored procs in SSIS. Here's the situation.

    I have an OLE DB Data Source set up to call a stored proc w\ no parameters. The stored procedure loops through a set of databases and inserts data from each database into a results table. I'm attempting to return the results table to SSIS, but the Available External Columns are not populating. However, previewing the query in SSIS does show results. The insert in to the results table is done by a call to sp_executesql.

    I've tried setting the results table up as a temp table, table variable, and static table. I have NOCOUNT set ON and am only returning one recordset. I've seen the other threads in here about similar problems, but none of their solutions seem to work for me.

    Any help would be much appreciated....

    I believe that there are known problems around using SPs in OLE DB Source components. Its something to do with requiring that the query that returns the data is the first statement in the proc. This enables SSIS to understand the metadata of the returned result set.

    I know this doesn't help you in your case though. I do not know if there is a workaround or not having never faced this problem before myself. I hope what I've said above goes some way to helping though.

    -Jamie

    |||I think OLE DB Command will execute the Store proc|||Try converting the sp to a multi-statement table-valued function, giving Data Access Mode for your OLE DB source as SQL Statement and specifying the statement SELECT * FROM your_table_valued_function(); the wizard will gussy the SQL up

    OLE DB Command transform and Output columns.

    Hi All,

    I have an OLE DB transform with a SQL Command of:

    sp_get_sponsor_parent ?,? OUTPUT

    where sp_get_sponsor_parent is defined like:

    CREATE PROCEDURE [dbo].[sp_get_sponsor_parent]

    @.pEID int,

    @.results int OUTPUT

    AS

    BEGIN

    .

    .

    .

    END

    I map the columns, refresh & OK out of the component without trouble, but on executing the package it fails during validation on this component. I'm utterly stumped.

    Any light shed would be greatly appreciated.

    Many thanks in advance,

    Tamim.

    I don't see any 'EXEC' in your sql commnad...may this be the problem?|||

    This wasn't the problem Rafael - the EXEC is optional.

    I resolved the issue however, by trialing just this one thing - outputting to a (derived) column within OLE DB Command - in a new/clean package. To that end I would like to bring the following example to everyone's attention: it's concise, comprehensive and clear, and thus can be considered canonical. No doubt there are other such examples out there, but this particular one helped me to push forwards, and thus deserves the publicity:

    http://wiki.sqlis.com/default.aspx/SQLISWiki/OLEDBCommandTransformationAndIdentityColumns.html?diff=y

    Thanks very much for your input Rafael.

    Cheers,

    Tamim.

    OLE DB Command and Stored Procedure that returns value and/or error

    Guys,

    could someone please tell me : am I supposed to use the OLE DB

    Command in a dataflow to call a stored procedure to return a value? Or

    is it just supposed to be used to call a straightforward insert

    statement only?

    What I am hoping to do:

    I have a table with a few columns and one identity column. In a

    dataflow I would like to effect an insert of a record to this table and

    retrieve the identity value of the inserted record... and I'd like to

    store the returned identity in a user variable.

    If I AM supposed to be able to do this... then how on earth do I do it?

    I have spent hours fooling around with the OLE DB command trying to call a stored proc and get a return value.

    In the Advanced Editor any time I try to add an output column (by

    clicking on Add Column) I just get an error dialog that says "the

    component does not allow adding columns to this input or output)

    So, am getting pretty concussed .. banging my head of the wall like this...

    So put me out of my misery someone please.... is the OLE DB Command intended for this or not?

    Thanks

    PJ

    I'm not terribly au fait with the OLE DB Command other than using it for UPDATEs but I do know that you can execute a stored procedure that uses values from the pipeline as parameters.

    I suspect that you cannot get return values from the sproc and add that returned value into the pipieline - I stand to be corrected though. I have never tried it.

    -Jamie

    |||

    PJ,

    You can probably look at this post..

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=490010&SiteID=1

    You can pass back return value into the pipe and use it in a derived column.

    |||

    PJ,

    I do not know how many rows are you planning to insert every time; but trying to capture the identity value at the dataflow sounds a kind of expensive from performance standpoitn. Have you consider to generate your own surrogatekey in a script task instead?

    Rafael Salas

    |||

    Hi there Rafael,

    Yeah, I suppose it could get pretty slow if you have a lot of data.. I only have ten small files (10 rows each) to load.. so its not a huge performance hit.

    An I already have a DAL written for other applications to call stored procs's and was hoping to use that....

    Its a while ago that I wrote the previous post.. and solved the problem in the meantime by writing a script task and calling the stored proc from inside that...

    It's an ok approach for me (using small amounts of data) but I remember it seemed like a lot of work to do something I think should be easy to do...

    Thanks

    PJ

    OLE DB Command and Stored Procedure that returns value and/or error

    Guys,
    could someone please tell me : am I supposed to use the OLE DB Command in a dataflow to call a stored procedure to return a value? Or is it just supposed to be used to call a straightforward insert statement only?
    What I am hoping to do:
    I have a table with a few columns and one identity column. In a dataflow I would like to effect an insert of a record to this table and retrieve the identity value of the inserted record... and I'd like to store the returned identity in a user variable.
    If I AM supposed to be able to do this... then how on earth do I do it?
    I have spent hours fooling around with the OLE DB command trying to call a stored proc and get a return value.
    In the Advanced Editor any time I try to add an output column (by clicking on Add Column) I just get an error dialog that says "the component does not allow adding columns to this input or output)
    So, am getting pretty concussed .. banging my head of the wall like this...
    So put me out of my misery someone please.... is the OLE DB Command intended for this or not?
    Thanks
    PJ

    I'm not terribly au fait with the OLE DB Command other than using it for UPDATEs but I do know that you can execute a stored procedure that uses values from the pipeline as parameters.

    I suspect that you cannot get return values from the sproc and add that returned value into the pipieline - I stand to be corrected though. I have never tried it.

    -Jamie

    |||

    PJ,

    You can probably look at this post..

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=490010&SiteID=1

    You can pass back return value into the pipe and use it in a derived column.

    |||

    PJ,

    I do not know how many rows are you planning to insert every time; but trying to capture the identity value at the dataflow sounds a kind of expensive from performance standpoitn. Have you consider to generate your own surrogatekey in a script task instead?

    Rafael Salas

    |||

    Hi there Rafael,

    Yeah, I suppose it could get pretty slow if you have a lot of data.. I only have ten small files (10 rows each) to load.. so its not a huge performance hit.

    An I already have a DAL written for other applications to call stored procs's and was hoping to use that....

    Its a while ago that I wrote the previous post.. and solved the problem in the meantime by writing a script task and calling the stored proc from inside that...

    It's an ok approach for me (using small amounts of data) but I remember it seemed like a lot of work to do something I think should be easy to do...

    Thanks

    PJ