SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Bizzare sp_makewebtask issue


Bizzare sp_makewebtask issue

Author
Message
erika.schwab
erika.schwab
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 12
I'm getting a bizzare error when I execute makewebtask. If I execute the bolded commented out @SQL I get the following failure:
Server: Msg 16805, Level 11, State 1, Procedure sp_makewebtask, Line 131
SQL Web Assistant: Could not execute the SQL statement.

But if I use the select statement instead of the stored procedure, it executes perfectly.

A little history, I'm a SA, so thats not the issue. I used the PRINT key word to make sure the stored procedure I'm executing inside @Query actually works, and it does. We also just recently migrated from SQL 2000 to 2005. The stored procedure was created in 2000. Has anyone seen anything like this before?

Working on this bit of code below:

DECLARE @muusid varchar(50)
declare @Reptitle varchar(500)
declare @SQL varchar(1000)

set @muusid = '#CAELS1'
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs'
--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + ''''

print @SQL
set @Reptitle = 'Mass Maintenance Status Report for ' + ltrim(rtrim(@muusid))

EXECUTE sp_makewebtask
@outputfile = 'y:\ftp\HtmlReports\MM_QUE_#CAELS1.htm'
,@query = @SQL
,@webpagetitle = 'MASS MAINTENANCE'
,@resultstitle = @Reptitle
,@dbname = 'ICG'
Lowell
Lowell
SSC Guru
SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)

Group: General Forum Members
Points: 155991 Visits: 41543
I've got two ideas to look at:
one is related to cross database chaining:
one command points to one database, and the other points to a different one ...which is correct?

set @muusid = '#CAELS1'
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs'
--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + ''''

the other thing is are you sure the stored procedure has SET NOCOUNT ON at the top?

you can get wierd results like you are describing if the store proc will return results, but doesn't have that command at the top.

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
erika.schwab
erika.schwab
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 12
I tried both of those methods and they both failed. the Set NoCount On was specified and I called both SQL statements from the same database. What I did find though, was that if I executed a stored procedure that passed no parameters in the @QUERY, then it worked fine, but I tested a few other stored procedures that did require a parameter to be passed and they all failed. Does anyone know why this might be? Was something set up improperly maybe when we migrated to the new server. This procedure was never an issue in 2000.
Thanks!
Lowell
Lowell
SSC Guru
SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)SSC Guru (155K reputation)

Group: General Forum Members
Points: 155991 Visits: 41543
I'll ask a different way:
when i create a stored procedure, i only want it to get data from the database it exists in.
It is incredibly rare that i create a procedure that gets data from a different database. if the two queries you posted existed int he database "prod", for example, then the OTHER databases "bpcssql" and "icg" must also exist on the same server...i'm betting they do not exist.

the queries you posted as an example referend to database outside of the database the procedure exists in...it might be that you want to change them: ie:
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs' -->>'select top 10 * from itemmasternew_bpcsand

--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + '''' -->>'execute SP_MM_ITEMSTATUS

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
erika.schwab
erika.schwab
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 12
They are all on the same server, we just ported everything in the same schema to 2005. I already used a select statement with the ICG database and it worked fine. Like I found, it is only when you pass a parameter into the stored procedure you're executing in the @Query statement. It does this no matter which database you're executing against.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search