Keeps asking for rpt file when executing store procedure

Hi all,
  I have coded an standard stored procedure but when I execute it, Management Studio keeps asking for .rpt file to save the results. I am using Enterprise 2008 R2. 
This is the code:
USE [mydatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_chart](
@parameters)
AS
BEGIN
 SET NOCOUNT ON;    
 DECLARE @query NVARCHAR(4000)
    DECLARE @total INT
    DECLARE @strDescriptor NVARCHAR(4000)
    DECLARE @dsvalues NVARCHAR(4000)
    DECLARE @strCache NVARCHAR(2000)
    SET @strDescriptor = dbo.udf_chart_derived_descriptor_intotemp(@derivation_Id)
 SET @dsvalues =  dbo.udf_chart_derived_dynamic_query_fortopn(  @derivation_Id,
       @cache_Id,
       @topn,
      @flt_customer_Id,
      @flt_user_Id,
      @flt_datefrom,
      @flt_dateto,
      @product_Id
    SET @strCache = 'SELECT top ' + @topn + 'PERCENT g.Supplier_Id Supplier_Id 
INTO #T_CacheTopN
FROM T_CacheSupp g 
WHERE g.Cache_Id = ' + @cache_Id + 
' ORDER BY g.Position'
    IF @strFilter is null 
     BEGIN
SET @query = @strCache + ';' + @strDescriptor + ';' +
'DECLARE @total INT;' +
@dsvalues +
'SELECT @total = COUNT(*)
 FROM #T_Condition; 
 SELECT c.Condition_Index, ROUND(COUNT(*)/CAST(@total as float),2)*100
 FROM #T_Condition c
 GROUP BY c.Condition_Index';
     END
    ELSE
     BEGIN
       DECLARE @sqlfilter NVARCHAR(2000)
  SET @sqlfilter =  dbo.udf_chart_dynamic_query_filter_fortopn(@strFilter,@product_Id,@topn, @cache_Id)
  SET @query = @strCache + ';' +@strDescriptor + ';' +
'DECLARE @total INT;' +
@dsvalues +
'SELECT @total = COUNT(*)
 FROM #T_Condition;'+ @sqlfilter +
 ';SELECT c.Condition_Index, ROUND(COUNT(*)/CAST(@total as float),2)*100 
 FROM #T_Condition c LEFT OUTER JOIN #T_NotWanted d
 ON c.Data_Id = d.Data_ID
 WHERE d.Data_Id is null
 GROUP BY c.Condition_Index';
     END 
    EXEC(@query)
    RETURN
END
When I execute:
DECLARE
@parameters NVARCHAR(4000)
execute usp_chart_derived_fortopn @parameters
it asks me for a .rpt file.
Why is that? I am not running a report.
Thanks

As other have said, you have set Results to File.
But since you posted your code, I had a look at it. I was not able to understand why you use dynamic SQL. For instance, this:
    SET @strCache = 'SELECT top ' + @topn + 'PERCENT g.Supplier_Id Supplier_Id 
INTO #T_CacheTopN
FROM T_CacheSupp g 
WHERE g.Cache_Id = ' + @cache_Id +  ' ORDER BY g.Position'
Can be written as
SELECT top (@topn) PERCENT g.Supplier_Id Supplier_Id 
INTO #T_CacheTopN
FROM T_CacheSupp g 
WHERE g.Cache_Id = @cache_Id  
ORDER BY g.Position
If you can avoid dynamic SQL, your code becomes easier to maintain, and less vulnerable for nasty surprises.
And if you use dynamic SQL, you should use sp_executesql and pass parameter values as parameters instead of inlining them.
Erland Sommarskog, SQL Server MVP, [email protected]
Links for SQL Server Books Online:
SQL 2008, SQL 2005 and 
SQL 2000.
(Just click the link you need.)

Similar Messages

  • My mac keeps asking for a password when I try to install adobe flash player and even with the hint I

    My mac keeps asking for a password when I try to install adobe flash player. Even with the hint I'm not getting it and also tried uninstall and the same thing occurred.

    It's referring to the MAC password that you have setup.
    A software prompts for a password only when there are restrictions set on the user account for unauthorised access to system files and folders.

  • I cannot retrieve my emails on my Mac Book Pro operating on 10.7.3 Icloud was already workingit keeps asking for password and when i put correct password in it keeps asking for it again and again. This has just started today

    I cannot retrieve my emails on my Mac Book Pro operating on 10.7.3 Icloud was already workingit keeps asking for password and when i put correct password in it keeps asking for it again and again. This has just started today

    Though it's unlikely to be wrong if things were set up properly in the first place, as a check go to Mail Preferences>Accounts and check that the server setting for IMAP (incoming) is imap.mail.me.com (not just mail.me.com).
    Your next step either way would be to go to System Preferences>iCloud and sign out, then sign back in again. (You can ignore warnings about data disappearing - your calendars etc. will disappear when you sign out but reappear when you sign back in).

  • Cant receive my yahoo mail on my latest ipad, keeps asking for my password, when I respond same message- password

    Suddenly can't receive my yahoo mail on my latest ipad, keeps asking for my password, when i
    put it in,same message flashes up, reset does not work, also waiting for apple time lapse, still does not want to give me my yahoo mail on this format, tried talking to apple online contact, cut off, I'm receiving through safari, nothing through my email app

    Give it time. Yahoo has been doing things to their servers that often muck up the Mail app. Usually it takes 24-48 hours to run its course then it'll work again.
    if it doesn't clear up by the end of the weekend, you can remove and readd your account, but chances are it'll just start to work.

  • Why does iTunes keep asking for my password when I want to listen to my music on my iPhone?

    When I want to listen to music on my iPhone, iTunes keeps asking for my password.  I am not purchasing anything.  It started today.  Why is that?

    I've been having the same problem on my iPad and iPhone. I talked to Apple customer service this morning. They had me do the following on both devices in the Settings:
    * Sign out of iTunes & App Store
    * Sign out of FaceTime
    * Sign out of Game Center
    * Delete iCloud account
    They also had me restore my iPad due to some glitchy behavior in the Music app.
    Things seemed to me fixed for a few hours until I went into the iTunes Store app on my iPad and added a movie to my Wish List. When I went back to the Music app, the dreaded "Sign In to iTunes Store" popup started showing up again on both devices. Suspicious!
    So, I cleared out my Wish List in both the iTunes Store and App Store. I've been poking at the Music app on both my iPhone and iPad since then I haven't seen that popup once since then. I'm not going to declare victory yet since it's only been an hour or two, but I thought that this was worth mentioning.

  • Why does imail on my iMac keep asking for passwords, that when I enter the correct one it does not recognise, but Yahoo does, its driving me nuts!!!!

    What is going on at Apple, mail keeps asking for a password, that when I enter, it ignores, my imac is telling me it cannot talk to the Yahoo server, but I can get through every time on Safari. This is driving me nuts!!!

    you are lucky i will say,
    i got problems with email, update,id,keyboard mistyping, wifi, they said they will send me one they never did, and don't reply anymore, after 55 days witha  3 years warranty. good luck. i swear it is true.

  • Hp pro 8500 keeps asking for maganta ink when it's already a new one, then loose image, please help

    HP PRO8500
    KEEPS ASKING FOR MAGANTA INK, THEN LOOSE IMAGE, I ALREADY REPLACED INK TWICE BUT ISSUE STILL PERSIST.
    PLEASE HELP

    Ok, finally got it fixed !
    Here's what was causing the issue, and what I did to fix it :
    I had free content in my iTunes download queue that I got from the "iTunes 12 days of Christmas" promotion, but the problem was that some of the items (two HD episodes) were too large to fit in my harddrive (I'm running low on free hd space) - so each time I was running iTunes I had to cancel the downloading of those items. On my iPhone, I was able to cancel the downloading once for all, but iTunes somehow wanted to try downloading them even if I deleted them. This was quite frustrating so I sent a mail to the support using the Express Lane feature on the support website, asking for thos items to be removed from my iTunes account - and tadaaaa ! Once a nice guy from Apple deleted them, my iPhone stopped asking for that stupid password !

  • Aperture keeps asking for serial number when I try to open it.

    When I try to open Aperture it asks for a serial nummber. I plug iin the serial number and it asks for the original version software number. I plug in that serail number but it will not accept it even though I have checked and it it the correct number.

    Jodie84,
    I have just checked your account and found that you indeed have bought a Creative Cloud for Teams subscription but you have assigned the single seat to another user hence you ( If you are using your own Adobe ID ) are getting the trial error message.
    Two options : Either reassign the seat to your self or add an additional seat and invite your self in the same Team.
    Cheers,
    Kartikay Sharma

  • Facetime keeps asking for my logon when i start up

    Everytime I reboot or start up Facetime asks for my logon .. I have vere used facetime   I have no interest in facetime in fact I would even like to recover the storage space this useless ap takes up

    Never empty the Trash in the shell (Terminal.)
    1. Triple-click the line below to select it:
    ~/.Trash
    2. Right-click or control-click the highlighted line and select
    Services ▹ Show Info
    from the contextual menu.* An Info dialog should open.
    3. The dialog should show "You can read and write" in the Sharing & Permissions section. If that's not what it shows, click the padlock icon in the lower right corner of the window and enter your password when prompted. Use the plus- and minus-sign buttons to give yourself Read & Write access and "everyone" No Access. Delete any other entries in the access list.
    4. In the General section, uncheck the box marked Locked if it's checked.
    5. From the action menu (gear icon) at the bottom of the dialog, select Apply to enclosed items and confirm.
    6. Close the Info window and test.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • Printer keeps asking for a password when printing in safari or firefox

    Hello I'm new to the Mac. I have been a PC User for over 30 years.
    Here is my issue. I print in safari or Firefox and every time it asks for a password from the user. I click remember the key but everytime it pops up when I want to print.
    How do I fix this.
    Thanks

    Hello, & welcome to the forums & Macdom!
    Welll, this is a new one on me, does it print from other Apps without a Password?
    Is this for any site, or just certain ones?

  • Thunderbird keeps asking for my password when I try to send emai but still doesn't work after I enter it.

    I am using Thunderbird Ver. 35 and yahoo mail as my server on a windows 7 64 bit computer. I use the same password on Thunderbird and Yahoo. I always click the "use password manager to remember password" box. Occasionally the mail is sent but very infrequently.
    Can you help?

    it's not asking for a user name just the pass word. I can log into Yahoo mail using my user name and password with no problem. I assume the user name is the same for both.

  • I can not remember my security answers to the questions, i am wanting to buy some music but it keeps asking for security questions when i cannot remember! What do i do?

    I want to buy new music off itunes website on my Ipad, i know my email and password, after i have typed them in it asks me for a security questionaire. However i do not remeber the answers, how am i meant to download music as this is stopping me from doing it. I really need help as it is really annoying me! Thank you.

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    (96967)

  • Keeps asking for keychain password when i open programs

    i open safari, it asks for a password. I open almost anything and it asks for a keychain password, and i put the password i use to login to my username and it says it is wrong. I want this off, i dont want this coming up, so how do i go along doing this, especially without the password?

    I'm not entirely sure this will work if your keychain is already locked, but try this:
    * Log in as the user who is having the issues
    * Open up System Preferences -> Accounts
    * Make sure the user under "My Account" is highlighted
    * Enter a new Password (you'll have to enter your currenty password first).
    Note: this does not have to be a different password, you can use the exact same password you are using now, but you must re-enter it.
    * Re-enter your password in the Verify field.
    * Click on the Show All Button or any other button to get System Preferences to save your changes.
    At this point a pop-up menu should show up telling you your keychain password has been reset. You may have to log out and back in again, but you shouldn't be getting the keychain pop errors any more.
    Alternatively if you don't have anything important in your keychain you can always delete your keychain and it's preferences, of course then you'll lose all the information that's stored there.
    HTH.
    -NifflerX

  • HT1725 trying to install and app from the app store.want let me keep asking for my iD when i enter it stillwont work

    keep going back to install Apple keep going back to install Apple ID when I ente when I enter my Apple ID it keeps saying verify Apple ID

    http://www.apple.com/support/mac/app-store/contact.html?form=account

  • Keeps asking for source file.

    As I work on a project, I save-as the file name for example: This (myproj.mxml) to this (myproj02.mxml) until eventually I save as up to 5 or 10 files. (myproj08.mxml) in the package explorer list on the left side of the flex builder project. When I am finished I delete all the files before my last one. I can delete them all but when I go to export release build I get an error telling me
    (Flash builder could not publish the project source: The application file myproj.mxml was not found).
    The project source must be the very first file created before I saved-as to number 2, because when I bring that first file back into the project, it works again.
    How do I sever ties with all previous file versions so I can keep just the last saved-as version in my flex builder project? Thanks.

    This is not a new problem. I have encountered it through many versions of QuickTime.
    Typically, it happens after I assemble a compilation of clips from various sources, including imported Windows Media files. I diligently check the "Save as a self-contained movie" option, which always indicates a file size larger than the "Save as reference movie" option -- for example, 1.7 MB vs. only 9.2 KB for a short clip. And yet, if I have discarded the original clip, QuickTime is unable to play some of the supposedly self-contained movies because it can't find the deleted source files. It's kind of maddening, especially when there's no way to recover the original clips.
    I haven't tracked this, but I suspect it might happen when a clip in one format is pasted into a movie without first converting it to QuickTime. Has anyone else noticed this possibility and tested it?

Maybe you are looking for